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>
using namespace std;

/*
0123
456
78
9
*/
const int data[7][10] = {
						{1, 1, 0, 0, 1, 1, 0, 0, 0, 0},
						{1, 0, 0, 0, 1, 0, 0, 1, 0, 1},
						{1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
						{0, 1, 0, 0, 1, 1, 0, 1, 0, 0},
						{1, 1, 0, 0, 0, 1, 1, 0, 0, 0},
						{1, 0, 0, 0, 1, 1, 0, 0, 1, 0},
						{0, 1, 1, 0, 1, 1, 0, 0, 0, 0}
						};

const int change[10][2] = {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 3}, {1, 3}, {0, 4}};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	while(1){
		int c[15][15];
		for(int i = 0; i < 15; ++i){
			for(int j = 0; j < 15; ++j){
				c[j][i] = 0;
			}
		}

		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				char c0;
				cin >> c0;
				c[j][i] = (c0 == '0') ? 0 : 1;
			}
		}

		if(cin.eof()){
			break;
		}

		bool check2 = false;
		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				for(int k = 0; k < 7; ++k){
					bool check = true;
					for(int l = 0; l < 10; ++l){
						if(c[j + change[l][0]][i + change[l][1]] != data[k][l]){
							check = false;
							break;
						}
					}
					if(check){
						cout << char('A' + k) << endl;
						check2 = true;
						break;
					}
				}
				if(check2) break;
			}
			if(check2) break;
		}
	}

	return 0;
}

C++: #include <bits/stdc++.h>  

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

char s[10][10];

int main() {
	while(cin >> s[0]) {
		FOR(i, 1, 8) cin >> s[i];
		rep(i, 8) rep(j, 8) if(s[i][j] == '1') {
			if(s[i][j+1] == '1') {
				if(s[i+1][j] == '1' && s[i+1][j+1] == '1') {
					printf("A\n");
					goto end;
				}
				else if(s[i+1][j+1] == '1' && s[i+1][j+2] == '1') {
					printf("E\n");
					goto end;
				}
				else if(s[i][j+2] == '1' && s[i][j+3] == '1') {
					printf("C\n");
					goto end;
				}
				else {
					printf("G\n");
					goto end;
				}
			}
			else {
				if(s[i-1][j-1] == '1' && s[i+1][j] == '1' && s[i+2][j-1] == '1') {
					printf("D\n");
					goto end;
				} 
				else if(s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1') {
					printf("F\n");
					goto end;
				}
				else {
					printf("B\n");
					goto end;
				}
			}
		}
		end:;
	}
	return 0;
}

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

int main(){
    int s[8][8];
    int tmp;
    string str;
    do{
        for(int i=0; i<8; i++){
            cin >> tmp;
            for(int j=7; j>=0; j--){
                s[i][j] = tmp % 10;
                tmp /= 10;
            }
        }
        for(int i=0; i<8; i++){
            for(int j=0; j<8; j++){
                if(s[i][j] == 1){
                    if(s[i][j+1] == 1 && s[i+1][j] == 1 && s[i+1][j+1] == 1) cout << "A" << endl;
                    if(s[i+1][j] == 1 && s[i+2][j] == 1 && s[i+3][j] == 1) cout << "B" << endl;
                    if(s[i][j+1] == 1 && s[i][j+2] == 1 && s[i][j+3] == 1) cout << "C" << endl;
                    if(s[i+1][j] == 1 && s[i+1][j-1] == 1 && s[i+2][j-1] == 1) cout << "D" << endl;
                    if(s[i][j+1] == 1 && s[i+1][j+1] == 1 && s[i+1][j+2] == 1) cout << "E" << endl;
                    if(s[i+1][j] == 1 && s[i+1][j+1] == 1 && s[i+2][j+1] == 1) cout << "F" << endl;
                    if(s[i][j+1] == 1 && s[i+1][j] == 1 && s[i+1][j-1] == 1) cout << "G" << endl;
                }
            }
        }
    }while(getline(cin, str));
    return 0;
}

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

struct Point{
public:
	int x,y;
	Point(int _x, int _y){x=_x;y=_y;}
	void show(){cout<<x<<","<<y<<endl;}
	bool eq(Point &a){return x==a.x && y==a.y;}
};

bool eqFig(vector<Point> &a, vector<Point> &b){
	if(a.size()!=b.size()){
		return false;
	}else{
		vector<Point>::iterator ita=a.begin(), itb=b.begin();
		for(;ita<a.end();++ita,++itb){
			if(!(ita->eq(*itb))){
				return false;
			}
		}
		return true;
	}
}

int main() {
	Point fig_a[4] = {Point(0,0),Point(1,0),Point(0,1),Point(1,1)};
	Point fig_b[4] = {Point(0,0),Point(0,1),Point(0,2),Point(0,3)};
	Point fig_c[4] = {Point(0,0),Point(1,0),Point(2,0),Point(3,0)};
	Point fig_d[4] = {Point(0,0),Point(-1,1),Point(0,1),Point(-1,2)};
	Point fig_e[4] = {Point(0,0),Point(1,0),Point(1,1),Point(2,1)};
	Point fig_f[4] = {Point(0,0),Point(0,1),Point(1,1),Point(1,2)};
	Point fig_g[4] = {Point(0,0),Point(1,0),Point(-1,1),Point(0,1)};
	
	vector< vector<Point> > figs{
		vector<Point>(fig_a,fig_a+4),
		vector<Point>(fig_b,fig_b+4),
		vector<Point>(fig_c,fig_c+4),
		vector<Point>(fig_d,fig_d+4),
		vector<Point>(fig_e,fig_e+4),
		vector<Point>(fig_f,fig_f+4),
		vector<Point>(fig_g,fig_g+4)
	};
	vector<Point>fig;
	unsigned char ch;
	
	do{
		fig.clear();
		int x=0,y=0,sx;
		bool flg=false;
		
		for(int i=0;i<8;++i){
			for(int j=0;j<8;++j){
				ch = getchar();
				if(ch == '1'){
					fig.push_back(Point(x,y));
					if(!flg)sx = j;
					flg = true;
				}
				if(flg){
					x = 1 + j - sx;
				}
			}
			if(flg)++y;
			getchar();
		}
		
		for(int i=0;i<7;++i){
			if(eqFig(figs[i],fig)){
				cout<<(char)('A'+i)<<endl;
				break;
			}
		}
		
	}while(getchar()!=EOF);
	return 0;
}