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)
	}
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
char fld[8][8];
int main(){
while(cin>>fld[0]){
    for(int i=1;i<8;i++){
        cin>>fld[i];
    }
    for(int i=0;i<8;i++){
        for(int j=0;j<8;j++){
            if(fld[i][j]=='1'){
                if(fld[i][j+1]=='1'&&fld[i+1][j]=='1'&&fld[i+1][j+1]=='1'){
                    cout<<'A'<<endl;
                }
                if(fld[i+1][j]=='1'&&fld[i+2][j]=='1'&&fld[i+3][j]=='1'){
                    cout<<'B'<<endl;
                }
                if(fld[i][j+1]=='1'&&fld[i][j+2]=='1'&&fld[i][j+3]=='1'){
                    cout<<'C'<<endl;
                }
                if(fld[i+1][j]=='1'&&fld[i+1][j-1]=='1'&&fld[i+2][j-1]=='1'){
                    cout<<'D'<<endl;
                }
                if(fld[i][j+1]=='1'&&fld[i+1][j+1]=='1'&&fld[i+1][j+2]=='1'){
                    cout<<'E'<<endl;
                }
                if(fld[i+1][j]=='1'&&fld[i+1][j+1]=='1'&&fld[i+2][j+1]=='1'){
                    cout<<'F'<<endl;
                }
                if(fld[i][j+1]=='1'&&fld[i+1][j]=='1'&&fld[i+1][j-1]=='1'){
                    cout<<'G'<<endl;
                }
            }
        }
    }
}
return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

char Types(char x[12][11]);

int main () {
    char x[100];
    for(int i=0; i<100; i++){
        x[i]='0';
    }
    int flag = 1;

    while(flag){

        for(int i=0; i<64; i++){
            cin>>x[i];
            if(x[i]==EOF){
                flag=0;
                break;
            }
        }
        if(flag!=1){
            break;
        }
        
        int first;
        for(int i=0; i<64; i++){
            if(x[i]=='1'){
                first=i;
                break;
            }
        }
        
        if(x[first+1]=='1'){
            if(x[first+2]=='1'){
                cout<<"C"<<endl;
            }else if(x[first+7]=='1'){
                cout<<"G"<<endl;
            }else if(x[first+10]=='1'){
                cout<<"E"<<endl;
            }else{
                cout<<"A"<<endl;
            }
        }else{
            if(x[first+7]=='1'){
                cout<<"D"<<endl;
            }else if(x[first+9]=='1'){
                cout<<"F"<<endl;
            }else{
                cout<<"B"<<endl;
            }
        }
        
        
    }
    
    return 0;
}

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

int main(){
	bool flag = false;
	char s[80];
	int hit[4];
	int i, j, n;

	while(1){
		n = 0;
		for (i = 0; i < 8; i++) {
			if(scanf("%s", s) == EOF){
				flag = true;
				break;
			}
			for (j = 0; j < 8; j++) {
				if(s[j] == '1'){
					hit[n++] = i*8+j;
				}
			}
		}
		if(flag){
			break;
		}
		switch(hit[3] - hit[0]){
			case 9:
				cout << "A" << endl;
				break;
			case 24:
				cout << "B" << endl;
				break;
			case 3:
				cout << "C" << endl;
				break;
			case 15:
				cout << "D" << endl;
				break;
			case 10:
				cout << "E" << endl;
				break;
			case 17:
				cout << "F" << endl;
				break;
			case 8:
				cout << "G" << endl;
				break;
			default:
				cout << "ERROR:" << hit[4] - hit[0] << endl;
		}
	}
	return 0;
}

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

int main(){
	string line[8];

	while(){


		int w = 0, h = 0, t=-1;

		for(int i=0;i<8;++i)
			cin >> line[i];

		int right=0,left=7;

		for(int i=0;i<8;++i){
			bool exist = false;
			for(int j=0;j<8;++j){
				if((line[i])[j] == '1'){
					if(t!=-1)t=i;
					if(j>right)right = j;
					if(j<left)left = j;
					exist = true;
				}
			}
			if(exist)++h;
		}
		w = right - left + 1;

		if( w == 2 && h == 2 )cout<<"A"<<endl;
		else if(w == 1)cout<<"B"<<endl;
		else if(h == 1)cout<<"C"<<endl;


		else if(w==2){
			for(int i=0;i<8;++i){
				if((line[i])[left] == '1'){
					if((line[i])[left+1]=='1')
						cout<<"D"<<endl;
					else
						cout<<"F"<<endl;
					break;
				}
			}
		}

		else if(h==2){
			for(int i=0;i<8;++i){
				if((line[t])[i]=='1'){
					if((line[t+1])[i]=='1')
						cout<<"G"<<endl;
					else
						cout<<"E"<<endl;
				}
			}
		}

	}
	return 0;
}