Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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 <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;
}

C++: #include <iostream>
#include <string>
#define rep(i, a, n) for(int i = a;i < n;i++)
using namespace std;


int tile[8][8];


void input(string& s){
	rep(i, 0, 8) tile[0][i] = (s[i] - '0');
	rep(i, 1, 8){
		cin >> s;
		rep(j, 0, 8)
			tile[i][j] = (s[j] - '0');
	}
}


bool A(int x, int y){
	if(x+1 > 7) return false;
	if(!tile[y][x+1]) return false;
	if(y+1 > 7) return false;
	if(!tile[y+1][x]) return false;
	if(!tile[y+1][x+1]) return false;
	return true;
}


bool B(int x, int y){
	if(y+1 > 7) return false;
	if(!tile[y+1][x]) return false;
	if(y+2 > 7) return false;
	if(!tile[y+2][x]) return false;
	if(y+3 > 7) return false;
	if(!tile[y+3][x]) return false;
	return true;
}


bool C(int x, int y){
	if(x+1 > 7) return false;
	if(!tile[y][x+1]) return false;
	if(x+2 > 7) return false;
	if(!tile[y][x+2]) return false;
	if(x+3 > 7) return false;
	if(!tile[y][x+3]) return false;
	return true;
}


bool D(int x, int y){
	if(y+1 > 7) return false;
	if(!tile[y+1][x]) return false;
	if(x-1 < 0) return false;
	if(!tile[y+1][x-1]) return false;
	if(y+2 > 7) return false;
	if(!tile[y+2][x-1]) return false;
	return true;
}


bool E(int x, int y){
	if(x+1 > 7) return false;
	if(!tile[y][x+1]) return false;
	if(y+1 > 7) return false;
	if(!tile[y+1][x+1]) return false;
	if(x+2 > 7) return false;
	if(!tile[y+1][x+2]) return false;
	return true;
}


bool F(int x, int y){
	if(y+1 > 7) return false;
	if(!tile[y+1][x]) return false;
	if(x+1 > 7) return false;
	if(!tile[y+1][x+1]) return false;
	if(y+2 > 7) return false;
	if(!tile[y+2][x+1]) return false;
	return true;
}


void startP(int& x, int& y){
	rep(i, 0, 8){
		rep(j, 0, 8){
			if(tile[i][j]){
				y = i;
				x = j;
				return;
			}
		}
	}
}


char solve(){
	int x, y;
	startP(x, y);
	if(A(x, y)) return 'A';
	if(B(x, y)) return 'B';
	if(C(x, y)) return 'C';
	if(D(x, y)) return 'D';
	if(E(x, y)) return 'E';
	if(F(x, y)) return 'F';
	return 'G';
}


int main(){
	string s;

	while(cin >> s){
		input(s);

		cout << solve() << endl;
	}

	return 0;
}