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>
#include <string>
using namespace std;
int main(){
	while(1){
		int b[8][8]={0};
		string str;
		for(int i=0;i<8;i++){
			cin>>str;
			for(int j=0;j<8;j++){
				b[i][j]=str[j]-48;
			}
		}
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(b[i][j] && b[i+1][j] && b[i][j+1] && b[i+1][j+1]){
					cout<<"A"<<endl;
				}else if(b[i][j] && b[i+1][j] && b[i+2][j] && b[i+3][j]){ 
					cout<<"B"<<endl;
				}else if(b[i][j] && b[i][j+1] && b[i][j+2] && b[i][j+3]){
					cout<<"C"<<endl;
				}else if(b[i][j] && b[i+1][j] && b[i+1][j-1] && b[i+2][j-1]){
					cout<<"D"<<endl;
				}else if(b[i][j] && b[i][j+1] && b[i+1][j+1] && b[i+1][j+2]){
					cout<<"E"<<endl;
				}else if(b[i][j] && b[i+1][j] && b[i+1][j+1] && b[i+2][j+1]){
					cout<<"F"<<endl;
				}else if(b[i][j] && b[i][j+1] && b[i+1][j] && b[i+1][j-1]){ 
					cout<<"G"<<endl;
				}
			}
		}
		
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    while (true)
    {
        string a[8];
        vector<int> tracex;
        vector<int> tracey;
        bool flag = false;
        rep(i, 8) if(!(cin >> a[i])) return 0;
        rep(i, 8)
            rep(j, 8) if (a[i][j] == '1')
        {
            tracex.push_back(j);
            tracey.push_back(i);
        }
        REP(i, 1, tracex.size())
        tracex[i] -= tracex[0];
        REP(i, 1, tracey.size())
        tracey[i] -= tracey[0];
        //tracex[0]=0;tracey[0]=0;
        if (tracex[3] == 1 && tracey[3] == 1)
            cout << "A" << endl;
        if (tracex[3] == 3)
            cout << "C" << endl;
        if (tracey[3] == 3)
            cout << "B" << endl;
        if (tracex[1] == -1 && tracey[3] == 2)
            cout << "D" << endl;
        if (tracex[3] == 2)
            cout << "E" << endl;
        if (tracex[2] == 1 && tracey[3] == 2)
            cout << "F" << endl;
        if (tracex[2] == -1 && tracey[2] == 1)
            cout << "G" << endl;
        if (flag)
            break;
    }
    return 0;
}

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

int main(){
    while(1){
        vector<string> v(8);
        int sx=8,sy=8,ex=-1,ey=-1;
        for(int i=0; i<8; i++){
            if(!(cin>>v[i])) goto end;
            for(int j=0; j<8; j++){
                if(v[i][j]=='1'){
                    sx=min(sx,j);
                    sy=min(sy,i);
                    ex=max(ex,j);
                    ey=max(ey,i);
                }
            }
        }
        char ans;
        if(sx==ex) ans='B';
        else if(sy==ey) ans='C';
        else if(ex-sx==1&&ey-sy==1) ans='A';
        else if(v[ey][ex]=='0'&&ex-sx==1) ans='G';
        else if(v[ey][ey]=='0'&&ex-sx==2) ans='D';
        else if(ex-sx==2) ans='E';
        else ans='F';
        cout<<ans<<endl;
    }
 end:;
}

C++: #include <iostream>

using namespace std;
int main()
{
  string a[8];
  for(;cin>>a[0];)
    {
      for(int i=1;i<8;i++)
	cin>>a[i];
      char n='X';
      for(int i=0;i<8;i++)
	for(int j=0;j<8;j++)
	  if(a[i][j]=='1')
	    {
	      if(i<7&&j<7&&a[i][j+1]=='1' &&a[i+1][j]=='1' &&a[i+1][j+1]=='1')
		n='A';
	      else if(i<5&&a[i+1][j]=='1' &&a[i+2][j]=='1' &&a[i+3][j]=='1')
		n='B';
	      else if(j<5&&a[i][j+1]=='1' &&a[i][j+2]=='1' &&a[i][j+3]=='1')
		n='C';
	      else if(j>0&&i<6&&a[i+1][j]=='1' &&a[i+1][j-1]=='1' &&a[i+2][j-1]=='1')
		n='D';
	      else if(i<7&&j<6&&a[i][j+1]=='1' &&a[i+1][j+1]=='1' &&a[i+1][j+2]=='1')
		n='E';
	      else if(i<6&&j<7&&a[i+1][j]=='1' &&a[i+1][j+1]=='1' &&a[i+2][j+1]=='1')
		n='F';
	      if(n!='X')
		break;
	    }
      if(n=='X')
	n='G';
      cout<<n<<endl;

    }
}

C++: #include<iostream>
using namespace std;
int main() {
	char l[8][8];
	const char c = '1';
	int a, b;
	for (int i = 0; i < 8; i++){
		cin >> l[i];
	}
	for (int i = 0; i < 8; i++){
		for (int j = 0; j < 8; j++){
			if (l[i][j] == c){
				a = i;
				b = j;
				break;
			}
		}
	}
	if (l[a][b + 1] == c){
		//ACEG
		if (l[a + 1][b] == c){
			if (l[a + 1][b + 1] == c){
				cout << 'A';
			}else cout << 'G';
		}
		else if (l[a][b + 2] == c) {
			cout << 'C';
		}else cout << 'E';
	}else{
		//BDF
		if (l[a + 2][b] == c){
			cout << 'B';
		}
		else if (l[a + 1][b + 1] == c){
			cout << 'F';
		}
		else cout << 'D';
	}
	cout << endl;
}