Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"reflect"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func scanBoard() [][]int {
	ret := make([][]int, 8)
	for k := range ret {
		ret[k] = make([]int, 8)
		for l := range ret[k] {
			ret[k][l] = 0
		}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		row := strings.Split(scanner.Text(), "")
		if reflect.DeepEqual(row, []string{}) {
			break
		}
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

var emptyBoard = [][]int{{0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0}}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, emptyBoard) {
			break
		}
		// fmt.Println(board)
		for i := 0; i < 7; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 {
					ans = "A"
				}
			}
		}
		for i := 0; i < 5; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+2][j] == 1 && board[i+3][j] == 1 {
					ans = "B"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 5; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i][j+2] == 1 && board[i][j+3] == 1 {
					ans = "C"
				}
			}
		}
		for i := 0; i < 6; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j+1] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j] == 1 {
					ans = "D"
				}
			}
		}
		for i := 0; i < 7; i++ {
			for j := 0; j < 6; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 && board[i+1][j+2] == 1 {
					ans = "E"
				}
			}
		}
		for i := 0; i < 7; i++ {
			for j := 0; j < 6; j++ {
				if board[i][j+1] == 1 && board[i][j+2] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 {
					ans = "G"
				}
			}
		}
		for i := 0; i < 6; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j+1] == 1 {
					ans = "F"
				}
			}
		}
		fmt.Println(ans)
		fmt.Scanln()
	}
}

C++: #include <iostream>
using namespace std;

int main() {


while(1){
	char a[8][8],ans;
int c[4],b[4],j=0;
for(int kk=0;kk<=3;kk++){
c[kk]=0;
b[kk]=0;
}
for(int k=0;k<=7;k++){
	for(int l=0;l<=7;l++){
		a[k][l]=0;
		cin>>a[k][l];
		if(a[k][l]=='1'){
			b[j]=k;
			c[j]=l;
			j=j+1;
		}
	}
}
if(b[1]==0&&c[1]==0){
	break;
}
if(c[3]==c[0]+1&&b[3]==b[0]+1){
	ans='A';
}
if(c[3]==c[0]&&b[3]==b[0]+3){
	ans='B';
}
if(c[3]==c[0]+3&&b[3]==b[0]){
	ans='C';
}
if(c[3]==c[0]-1&&b[3]==b[0]+2){
	ans='D';
}
if(c[3]==c[0]+2&&b[3]==b[0]+1){
	ans='E';
}
if(c[3]==c[0]+1&&b[3]==b[0]+2){
	ans='F';
}
if(c[3]==c[0]&&b[3]==b[0]+1){
	ans='G';
}
cout<<ans<<endl;

}
return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;

string func(char a[10][10], int s, int t)
{
	if(s+1 < 8 && t+1 < 8){
		if(a[s][t+1]=='1' && a[s+1][t+1]=='1' && a[s+1][t]=='1'){
			return "A";
		}
	}
	if(s+3 < 8){
		if(a[s+1][t]=='1' && a[s+2][t]=='1' && a[s+3][t]=='1'){
			return "B";
		}
	}
	if(t+3 < 8){
		if(a[s][t+1]=='1' && a[s][t+2]=='1' && a[s][t+3]=='1'){
			return "C";
		}
	}
	if(s+2 < 8 && t-1 >= 0){
		if(a[s+1][t]=='1' && a[s+1][t-1]=='1' && a[s+2][t-1]=='1'){
			return "D";
		}
	}
	if(s+1 < 8 && t+2 < 8){
		if(a[s][t+1]=='1' && a[s+1][t+1]=='1' && a[s+1][t+2]=='1'){
			return "E";
		}
	}
	if(s+2 < 8 && t+1 < 8){
		if(a[s+1][t]=='1' && a[s+1][t+1]=='1' && a[s+2][t+1]=='1'){
			return "F";
		}
	}
	
	return "G";
}

int main()
{
	char a[10][10];
	
	while(cin >> a[0]){
		for(int i = 1; i < 8; i++){
			cin >> a[i];
		}
		bool f = false;
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(a[i][j] == '1'){
					cout << func(a, i, j) << endl;
					f = true;
					break;
				}
			}
			if(f){
				break;
			}
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;

int table[12][10];

int main(){
    while (1) {
        char ans;
        ans = 'S';
        for (int i=0; i<12; i++) {
            for (int j=0; j<10; j++) {
                table[i][j] = 0;
            }
        }
//        char line[100];
//        //cin.ignore();
//        cin>>line;
//        //cout<<line<<endl;
//        if (line[0] == EOF) {
//            return 0;
//        }
//        //cout<<"a"<<endl;
//        if (line[0] == '\n') {
//            cout<<"continue"<<endl;
//            continue;
//        }
//        //cout<<"b"<<endl;
//        for (int i=1; i<9; i++) {
//            table[1][i] = atoi(&line[i-1]);
//        }
//        for (int j=2; j<9; j++) {
//            cin.ignore();
//            cin>>line;
//            for (int i=1; i<9; i++) {
//                table[1][i] = atoi(&line[i-1]);
//            }
//        }
        for (int i=0; i<8; i++) {
            string line;
            cin>>line;
            for (int j=1; j<9; j++) {
                table[i+1][j] = (int)(line[j-1]-'0');
            }
        }
        
//        for (int i=1; i<9; i++) {
//            for (int j=1; j<9; j++) {
//                cout<<table[i][j]<<" ";
//            }
//            cout<<endl;
//        }
        
        int i=1,j=1;
        while (1){
            j++;
            if (j > 8) {
                j = 1;
                i++;
            }
            if (table[i][j] == 1) {
                //A
                if (table[i][j+1]==1 && table[i+1][j] == 1 && table[i+1][j+1] == 1) {
                    ans = 'A';
                    break;
                }
                //B
                else if (table[i+1][j] == 1 && table[i+1][j] == 1){
                    ans = 'B';
                    break;
                }
                //C
                else if (table[i][j+1] == 1 && table[i][j+2] == 1){
                    ans = 'C';
                    break;
                }
                //D
                else if (table[i+1][j] == 1 && table[i+1][j-1] == 1){
                    ans = 'D';
                    break;
                }
                //E
                else if (table[i+1][j+2] == 1){
                    ans = 'E';
                    break;
                }
                //F
                else if (table[i+2][j+1] == 1){
                    ans = 'F';
                    break;
                }
                //G
                else if (table[i][j+1] == 1 && table[i+1][j-1] == 1){
                    ans = 'G';
                    break;
                }
            }
        }
        cout<<ans<<endl;
        
        string str;
        cin>>str;
        if (str[0] == EOF) {
            return 0;
        }else if (str[0] == '\n'){
            continue;
        }
    }
}