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(), "")
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
char s[100][100];
int main(){
	

	while(cin>>s[1][1]){
		string a;
		int x,y;
		bool f=false;
		if(s[1][1]=='1'&&!f){
					y=1;
					x=1;
					f=true;
				}
		for(int j=2;j<8;j++){
			cin>>s[1][j];
			if(s[1][j]=='1'&&!f){
					y=1;
					x=j;
					f=true;
				}
		}
		for(int i=2;i<=8;i++){
			for(int j=1;j<=8;j++){
				cin>>s[i][j];
				if(s[i][j]=='1'&&!f){
					y=i;
					x=j;
					f=true;
				}
			}
		}
		
		if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1')
			cout<<"A"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+2][x]=='1'&&s[y+3][x]=='1')
			cout<<"B"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y][x+2]=='1'&&s[y][x+3]=='1')
			cout<<"C"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1'&&s[y+2][x-1]=='1')
			cout<<"D"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1'&&s[y+1][x+2]=='1')
			cout<<"E"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x+1]=='1'&&s[y+2][x+1]=='1')
			cout<<"F"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1')
			cout<<"G"<<endl;
		cin>>a;
	}
}

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

struct pattern_t {
    int w;
    int h;
    char *pat;
    pattern_t( const int _w, const int _h, const char *_pat ){
        w = _w;
        h = _h;
        pat = new char[w*h];
        for( int i=0; i<w*h; i++ ){
            pat[i] = _pat[i];
        }
    }
    ~pattern_t(){
        if( pat ){
            delete[] pat;
            pat = 0;
        }
    }
};

int main(){
    pattern_t patA(2,2,"1111"),
              patB(1,4,"1111"),
              patC(4,1,"1111"),
              patD(2,3,"011110"),
              patE(3,2,"110011"),
              patF(2,3,"101101"),
              patG(3,2,"011110");
    pattern_t *patterns[7] = {&patA, &patB, &patC, &patD, &patE, &patF, &patG};
    char field[8][8];
    for( int i=0; i<8; i++ ){
        string in;
        cin >> in;
        for( int j=0; j<8; j++ ){
            field[i][j] = in[j];
        }
    }
    for( int sy=0; sy<8; sy++ ){
        for( int sx=0; sx<8; sx++ ){
            for( int p=0; p<7; p++ ){
                pattern_t *pt = patterns[p];
                if( sy+pt->h > 8 || sx+pt->w > 8 )
                    continue;
                bool miss = false;
                for( int dy=0; dy<pt->h; dy++ ){
                    for( int dx=0; dx<pt->w; dx++ ){
                        if( pt->pat[dy*pt->w+dx] != field[sy+dy][sx+dx] ){
                            miss = true;
                            break;
                        }
                    }
                    if( miss )  break;
                }
                if( !miss ){
                    cout << (char)('A'+p) << endl;
                }
            }
        }
    }
    return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

const int N = 8;
char m[N][N];

inline bool check(int x, int y){ return 0<=x&&x<N && 0<=y&&y<N; }

int main()
{
  while(true){
    rep(i, N) rep(j, N) if(!(cin >> m[i][j])) return 0;

    rep(i, N) rep(j, N) if(m[i][j] == '1'){
      if(check(i+1, j+1) && m[i+1][j]=='1' && m[i][j+1]  =='1' && m[i+1][j+1]=='1') cout << "A" << endl;
      if(check(i+3, j  ) && m[i+1][j]=='1' && m[i+2][j]  =='1' && m[i+3][j]  =='1') cout << "B" << endl;
      if(check(i  , j+3) && m[i][j+1]=='1' && m[i][j+2]  =='1' && m[i][j+3]  =='1') cout << "C" << endl;
      if(check(i+2, j-1) && m[i+1][j]=='1' && m[i+1][j-1]=='1' && m[i+2][j-1]=='1') cout << "D" << endl;
      if(check(i+1, j+2) && m[i][j+1]=='1' && m[i+1][j+1]=='1' && m[i+1][j+2]=='1') cout << "E" << endl;
      if(check(i+2, j+1) && m[i+1][j]=='1' && m[i+1][j+1]=='1' && m[i+2][j+1]=='1') cout << "F" << endl;
      if(check(i+1, j+2) &&
         check(i-1, j+2) && m[i][j+1]=='1' && m[i+1][j-1]=='1' && m[i+1][j]  =='1') cout << "G" << endl;
      break;
    }
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
char G[8][8];
bool p(int i, int j){return (0<=i&&i<8&&0<=j&&j<8)&&(G[i][j] == '1');}
main(){
    while( cin >> G[0][0] ){
	int si = 0, sj = 0;
	rep(i, 8) rep(j, 8) {
	    if (i+j == 0) continue;
	    cin >> G[i][j];
	    if(G[i][j] == '1') { si = i; sj = j;}
	}
	char ch = 'A';
	if ( p(si-3, sj) ) ch = 'B';
	else if ( p(si, sj-3) ) ch = 'C';
	else if ( p(si-2, sj+1)) ch = 'D';
	else if ( p(si-1, sj-2)) ch = 'E';
	else if ( p(si-2, sj-1)) ch = 'F';
	else if ( p(si, sj-1) && p(si-1, sj+1) ) ch = 'G';
	cout << ch << endl;
    }
}

C++: #include <cstdio>

using namespace std;

int answer[] = {18, 48, 6, 30, 20, 34, 16};

int main() {
	int i, t, sum;
	char line[10];
	char c, a;

	while(true) {
		t = -1, sum = 0;
		for(i = 0; i < 64; i++) {
			c = getchar();
			if(c == EOF) return 0;
			if(c == '1') {
				if(t == -1) t = i;
				sum += i - t;
			}
			if(i % 8 == 7) getchar();
		}
		getchar();
		for(i = 0; i < 7; i++) {
			if(answer[i] == sum)
			a = 'A' + i;
		}
		printf("%c\n", a);
	}

	return 0;
}