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 <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	char ans = '0', wk;
	int F[16][16];
	while(cin >> wk)
	{
		memset(F, 0, sizeof(F));
		F[0][0] = wk - '0';
		ans = '0';


		for(int i = 0; i < 8; i++)
		{
			for(int j = 0; j < 8; j++)
			{
				if(i == 0 && j == 0)
					continue;
				cin >> wk;
				F[i][j] = wk - '0';
			}
		}

		for(int i = 0; i < 8; i++)
		{
			for(int j = 0; j < 8; j++)
			{
				if(F[i][j] && F[i][j+1] && F[i+1][j] && F[i+1][j+1])
				{
					ans = 'A';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+2][j] && F[i+3][j])
				{
					ans = 'B';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i][j+2] && F[i][j+3])
				{
					ans = 'C';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+1][j-1] && F[i+2][j-1])
				{
					ans = 'D';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i+1][j+1] && F[i+1][j+2])
				{
					ans = 'E';
					break;
				}
				if(F[i][j] && F[i+1][j] && F[i+1][j+1] && F[i+2][j+1])
				{
					ans = 'F';
					break;
				}
				if(F[i][j] && F[i][j+1] && F[i-1][j+1] && F[i-1][j+2])
				{
					ans = 'G';
					break;
				}
			}
			if(ans != '0')
			{
				break;
			}
		}

		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string mass[8];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i-1][j] == '1' && mass[i-1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    bool f;
    
    while (!cin.eof()) {
        f = false;

        for (int i = 0; i < 8; i++) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}

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

const double EPS = 1.0e-6;

int main()
{
	while(1){
		string all[8];
		bool endflg = false;
		for(int i=0; i<8; i++){
			if(!(cin>>all[i])) endflg = true;
			if(endflg) break;
		}
		if(endflg) break;

		for(int i=0; i<7; i++){
			bool breakflg = false;
			for(int j=0; j<7; j++){
				// ツ可。ツづ可個ゥツづゥ
				if(all[i][j]-'0'==1&&all[i][j+1]-'0'==1){
					if(all[i+1][j]-'0'==1&&all[i+1][j+1]-'0'==1){
						ans = "A";
					} else if(all[i+1][j]-'0'==0&&all[i+1][j+1]-'0'==0){
						ans = "C";
					} else if(all[i+1][j]-'0'==1&&all[i+1][j+1]-'0'==0){
						ans = "G";
					} else if(all[i+1][j]-'0'==0&&all[i+1][j+1]-'0'==1){
						ans = "E";
					}
					breakflg = true;
					break;
				}
				// ツ縦ツづ可個ゥツづゥ
				if(all[i][j]-'0'==1&&all[i+1][j]-'0'==1){
					if(all[i][j+1]-'0'==1&&all[i+1][j+1]-'0'==1){
						ans = "A";
					} else if(all[i][j+1]-'0'==0&&all[i+1][j+1]-'0'==0){
						ans = "B";
					} else if(all[i][j+1]-'0'==1&&all[i+1][j+1]-'0'==0){
						ans = "D";
					} else if(all[i][j+1]-'0'==0&&all[i+1][j+1]-'0'==1){
						ans = "F";
					}
					breakflg = true;
					break;
				}
			}
			if(breakflg) break;
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

#define rep(i,a,b) for(int i=a; i<b; i++)
#define loop(i,n) rep(i,0,n)

int main(){
    char b[8][9];
    while(1){
        loop(i,8)if(!(cin>>b[i])) return 0;
        int maxx=-1,maxy=-1,minx=8,miny=8;
        loop(y,8)loop(x,8){
            if(b[y][x]=='1'){
                minx=min(x,minx),miny=min(y,miny);
                maxx=max(x,maxx),maxy=max(y,maxy);
            }
        }
        int dx=maxx-minx,dy=maxy-miny;
        char ans;
        if(dx==1&&dy==1) ans='A';
        else if(dx==0) ans='B';
        else if(dy==0) ans='C';
        else if(b[miny][minx]=='0'){
            if(dx==1) ans='D';
            else ans='G';
        } else {
            if(dx==1) ans='F';
            else ans='E';
        }
        cout<<ans<<endl;
    }
}