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

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	char p[8][9];
	int i,j;
	while(cin>>p[0]>>p[1]>>p[2]>>p[3]>>p[4]>>p[5]>>p[6]>>p[7]){
		for(i=0; i<8 ; ++i){
			for(j=0 ;j < 9 ; ++j){
				if(p[i][j]=='1') goto next; 
			}
		}
		next:
		if (p[i][j+1]=='1' &&p[i+1][j]=='1' && p[i+1][j+1]=='1') cout << 'A' << endl;
		else if (p[i+1][j]=='1' && p[i+2][j]=='1' && p[i+3][j]=='1') cout << 'B' << endl;
		else if (p[i][j+1]=='1' && p[i][j+2]=='1' && p[i][j+3]=='1') cout << 'C' << endl;
		else if (p[i+1][j]=='1' && p[i+1][j-1]=='1' && p[i+2][j-1]=='1' ) cout << 'D' << endl;
		else if (p[i][j+1]=='1' && p[i+1][j+1]=='1' && p[i+1][j+2]=='1' ) cout << 'E' << endl;
		else if (p[i+1][j]=='1' && p[i+1][j+1]=='1' && p[i+2][j+1]=='1' ) cout << 'F' << endl;
		else if (p[i][j+1]=='1' && p[i+1][j]=='1' && p[i+1][j-1]=='1' ) cout << 'G' << endl;
	}
	return 0; 
}

C++: //a
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
 
#define REP(i,b,n) for(int i=b;i<n;++i)
#define REPR(i,b,n) for(int i=n-1;i>=b;--i)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PI acos(-1.0)

using namespace std;

static const double EPS = 1e-9;
typedef pair<double, int> stn;
typedef long long ll;

string ptn[7] = {	"1100110000000000",
					"1000100010001000",
					"1111000000000000",
					"0100110010000000",
					"1100011000000000",
					"1000110001000000"
					"0110110000000000"};

int main(){
	
	while(!cin.eof()){
	
		char ans = 0;
		vector<string> surf = vector<string>(16, "0000000000000000");
		
		for(int i = 0; i < 8; ++i){
		
			string str;
			cin >> str;
			surf[i] = str;
		}
		
		for(int y = 0; y < 8; ++y){
			for(int x = 0; x < 8; ++x){
				
				if(surf[y][x] == '1'){
					for(int k = 0; k < 7; ++k){
						
						int cnt = 0;
						
						for(int i = 0; i < 16; ++i){
							if( ptn[k][i] == surf[y+i/4][x+i%4] )
								cnt++;
							else
								break;
						}
						
						if(cnt>=16){
							ans = char('A'+k);
							goto out;
						}
						
					}
				}
				
			}
		}
		
	out:
		if(ans)
			cout << ans << endl;
	}
	
	return 0;
}

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

string map[8];

void check( int x, int y ){
	int blocks[7][3][2] = {
		{{1,0}, {0,1}, {1,1}},
		{{0,1}, {0,2}, {0,3}},
		{{1,0}, {2,0}, {3,0}},
		{{0,1}, {-1,1}, {-1,2}},
		{{1,0}, {1,1}, {2,1}},
		{{0,1}, {1,1}, {1,2}},
		{{1,0}, {0,1}, {-1,1}}
	};
	for( int i=0; i<7; i++ ){
		bool match = true;
		for( int j=0; j<3; j++ ){
			int xx = x+blocks[i][j][0];
			int yy = y+blocks[i][j][1];
			if( xx<0 || xx>=8 || yy<0 || yy>=8 ){
				match = false;
				break;
			}
			if( map[yy][xx] == '0' ){
				match = false;
			}
		}
		if( match ){
			cout << (char)('A'+i) << endl;
			break;
		}
	}
}

int main(){
	while(1){
		int k = -1;
		for( int i=0; i<8; i++ ){
			getline( cin, map[i] );
			if( map[i].length() != 8 )	return 0;
			if( k==-1 && map[i]!="00000000" ){
				k = i;
			}
		}
		for( int i=0; i<8; i++ ){
			if( map[k][i] == '1' ){
				check(i, k);
				break;
			}
		}
		string br;
		getline( cin, br );
	}
	return 0;
}