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 <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

string s[7][4] =
{
	{
		"1100",
		"1100",
		"0000",
		"0000"
	},
	{
		"1000",
		"1000",
		"1000",
		"1000"
	},
	{
		"1111",
		"0000",
		"0000",
		"0000"
	},
	{
		"0100",
		"1100",
		"1000",
		"0000"
	},
	{
		"1100",
		"0110",
		"0000",
		"0000"
	},
	{
		"1000",
		"1100",
		"0100",
		"0000"
	},
	{
		"0110",
		"1100",
		"0000",
		"0000"
	}
};
string Add = "00000000000";

int main() {
	string str;
	while ( cin >> str ) {
		VS d;
		d.push_back( str + "000" );
		for ( int i = 0; i < 7; i++ ) {
			cin >> str;
			d.push_back( str + "000" );
		}
		d.push_back( Add );
		d.push_back( Add );
		d.push_back( Add );
		bool break_check = false;
		for ( int i = 0; i < 8; i++ ) {
			for ( int j = 0; j < 8; j++ ) {
				for ( int k = 0; k < 7; k++ ) {
					break_check = true;
					for ( int l = i; l < i + 4; l++ ) {
						if ( d[ l ].substr( j, 4 ) != s[ k ][ l - i ] ) {
							break_check = false;
							break;
						}
					}
					if ( break_check ) {
						printf( "%c\n", k + 'A' );
						break;
					}
				}
				if ( break_check ) {
					break;
				}
			}
			if ( break_check ) {
				break;
			}
		}
	}
	return 0;
}

C++: #include<stdio.h>
int memo[4][2]={0};
char n;
int cou;
int main()
{
    while(1)
    {
        cou=0;
        for(int i=0;i<8;i++)
        {
            for(int j=0;j<9;j++)
            {
                if(scanf("%c",&n)!=EOF)
                {
                    if(n!='0'&&n!='\n')
                    {
                        memo[cou][0]=i;
                        memo[cou][1]=j;
                        cou++;
                    }
                }
                else return 0;
            }
        }
        if(memo[0][0]==memo[1][0])//A,C,E,G
        {
            if(memo[1][1]==memo[2][1]||memo[0][1]==memo[3][1])//E,G
            {
                if(memo[1][1]==memo[2][1])printf("E\n");
                else printf("G\n");
            }
            else//A,C
            {
                if(memo[0][0]==memo[3][0])printf("C\n");
                else printf("A\n");
            }
        }
        else//B,D,F
        {
            if(memo[0][1]==memo[3][1])printf("B\n");
            else//D,F
            {
                if(memo[0][1]==memo[1][1])printf("F\n");
                else printf("D\n");
            }
        }
    }
}

C++: #include <iostream>

using namespace std;

void solve()
{
	char F11;
	char Field[13][13];
	while(cin >> F11)
	{
		for(int i = 0; i < 13; ++i)
		{
			for(int j = 0; j < 13; ++j)
			{
				Field[i][j] = '2';
			}
		}
		Field[1][1] = F11;
		for(int i = 2; i < 9; ++i)
		{
			cin >> Field[1][i];
		}
		for(int i = 2; i < 9; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				cin >> Field[i][j];
			}
		}
		for(int i = 1; i < 9; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				if(Field[i][j] == '1')
				{
					if(Field[i][j + 1] == '1' && Field[i + 1][j] == '1' && Field[i + 1][j + 1] == '1')
					{
						cout << "A" << endl;
					}
					else if(Field[i + 1][j] == '1' && Field[i + 2][j] == '1' && Field[i + 3][j] == '1')
					{
						cout << "B" << endl;
					}
					else if(Field[i][j + 1] == '1' && Field[i][j + 2] == '1' && Field[i][j + 3] == '1')
					{
						cout << "C" << endl;
					}
					else if(Field[i + 1][j - 1] == '1' && Field[i + 1][j] == '1' && Field[i + 2][j - 1] == '1')
					{
						cout << "D" << endl;
					}
					else if(Field[i][j + 1] == '1' && Field[i + 1][j + 1] == '1' && Field[i + 1][j + 2] == '1')
					{
						cout << "E" << endl;
					}
					else if(Field[i + 1][j] == '1' && Field[i + 1][j + 1] == '1' && Field[i + 2][j + 1] == '1')
					{
						cout << "F" << endl;
					}
					else if(Field[i][j + 1] == '1' && Field[i + 1][j - 1] == '1' && Field[i + 1][j] == '1')
					{
						cout << "G" << endl;
					}
				}
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}