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

C++: #include<bits/stdc++.h>
using namespace std;
char str[9][9];
int mx[4]={1,0,-1,0},my[4]={0,1,0,-1},moving[4];
void serch(int mo,int y,int x)
{
    for(int i=0;i<4;i++){
            if(str[my[i]+y][x+mx[i]]=='1'&&my[i]+y>=0&&my[i]+y<9&&mx[i]+x>=0&&mx[i]+x<9){
                str[my[i]+y][x+mx[i]]='0';
                moving[mo]=i;
                serch(mo+1,y+my[i],x+mx[i]);
            }

    }
}
int main()
{
    int co=0;
    while(cin>>str[0]){
        for(int i=1;i<8;i++)cin>>str[i];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(str[i][j]=='1'&&co==0){
                    str[i][j]='0';
                    serch(0,i,j);
                    co=1;
                    break;
                }
                else if(str[i][j]=='1'&&co==1)co++;
            }
        }
        if(moving[0]==0&&co!=2){
            if(moving[1]==1){
                if(moving[2]==2)cout<<"A"<<endl;
                else cout<<"E"<<endl;
            }
            else cout<<"C"<<endl;
        }
        else if(moving[0]==3&&co!=2){
            if(moving[1]==0)cout<<"F"<<endl;
            else if(moving[1]==3)cout<<"B"<<endl;
            else cout<<"D"<<endl;
        }
        else cout<<"G"<<endl;
        co=0;
    }
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    enum blocks{
        A = 18, B = 48, C = 6, D = 30, E = 20, F = 34, G = 16
    };
    string surface, input;
    while(cin >> input){
        surface = input;
        rep(i,7){
            cin >> input;
            surface+= input;
        }
        int first = 0, location = 0;
        rep(i,65){
            if(surface[i] == '1' && first == 0){
                first = i;
            }else if(surface[i] == '1'){
                location+= i - first;
            }
        }
        if(A == location) cout << 'A' << endl;
        else if(B == location) cout << 'B' << endl;
        else if(C == location) cout << 'C' << endl;
        else if(D == location) cout << 'D' << endl;
        else if(E == location) cout << 'E' << endl;
        else if(F == location) cout << 'F' << endl;
        else if(G == location) cout << 'G' << endl;
    }
}

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

int main() {
	char t, c;
	vector<vector<char> > v(8, vector<char>(8, 0));

	while (cin >> c) {
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (i == 0 && j == 0) {
					v.at(0).at(0) = c;
				}
				else {
					cin >> c;
					v.at(i).at(j) = c;
				}
				/*
				cout << v.at(i).at(j);
				if (j == 7) cout << endl;
				if (i == 7 && j == 7) cout << endl;
				*/
			}
		}

		int f = 0;
		int cnt = 0;
		typedef struct point {
			int f, s;
		} Ps;
		Ps a, b;

		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				char ch = v.at(i).at(j);
				if (ch == '1') cnt++;

				if (ch == '1' && cnt == 1) {
					a.f = i;
					a.s = j;
				}
				else if (ch == '1' && cnt == 4) {
					b.f = i;
					b.s = j;
				}

				if (cnt == 4) break;
			}

			if (cnt == 4) break;
		}
		//cout << a.f << ' ' << a.s << endl;
		//cout << b.f << ' ' << b.s << endl;

		if (a.f + 1 == b.f) {
			if (a.s + 1 == b.s) t = 'A';
			if (a.s == b.s) t = 'G';
			if (a.s + 2 == b.s) t = 'E';
		}
		else if (a.f + 2 == b.f) {
			if (a.s - 1 == b.s) t = 'D';
			if (a.s + 1 == b.s) t = 'F';
		}
		else if (a.f == b.f) {
			t = 'C';
		}
		else if (a.f + 3 == b.f) {
			t = 'B';
		}

		cout << t << endl;
	}
}