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<iostream>
#include<string>

using namespace std;

#define ROW 8
#define COLUMN 8

void get_ans( string *matrix_str , char& ans );

int main(void)
{
	int matrix[ROW][COLUMN];
	string matrix_str[COLUMN];
	char c;

	while(1)
	{
		char ans = '0';
		int flag = 0; // 二重ループ脱出用
		for( int i = 0 ; i < COLUMN ; i++ )
		{
			cin >> matrix_str[i];
			if( cin.eof() )
			{
				flag = 1;
				break;
			}
		}
		if( flag == 1 )
		{
			break;
		}
		get_ans( matrix_str , ans );
		cout << ans << endl;
	}

	return 0;
}

void get_ans( string *matrix_str , char& ans )
{
	for( int i = 0 ; i < ROW ; i++ )
	{
		for( int j = 0 ; j < COLUMN ; j++ )
		{
			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+1].at(j+1) == '1' )
			{
				ans = 'A';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+2].at(j) == '1' &&
				matrix_str[i+3].at(j) == '1' )
			{
				ans = 'B';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i].at(j+2) == '1' &&
				matrix_str[i].at(j+3) == '1' )
			{
				ans = 'C';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j-1) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+2].at(j-1) == '1' )
			{
				ans = 'D';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j+1) == '1' &&
				matrix_str[i+1].at(j+2) == '1' )
			{
				ans = 'E';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+1].at(j+1) == '1' &&
				matrix_str[i+2].at(j+1) == '1' )
			{
				ans = 'F';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j-1) == '1' &&
				matrix_str[i+1].at(j) == '1' )
			{
				ans = 'G';
			}
		}
	}
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
struct P {int x, y; char s[4][5];};
char f[8][9] = {{""}};
bool c(int x, int y, P p)
{
	int i, j;
	char t[8][9];
	for (i = 0; i < 8; i++)
		strcpy(t[i], f[i]);
	for (i = 0; i < p.y; i++)
	{
		for (j = 0; j < p.x; j++)
		{
			t[y+i][x+j] = p.s[i][j];
		}
	}
	for (i = 0; i < 8; i++)
		if (strcmp(t[i], f[i]) != 0)
		{
			return false;
		}
	return true;
}
int main()
{
	P p[7] = {2, 2, {"11", "11"},
		1, 4, {"1", "1", "1", "1"},
		4, 1, {"1111"},
		2, 3, {"01", "11", "10"},
		3, 2, {"110", "011"},
		2, 3, {"10", "11", "01"},
		3, 2, {"011", "110"}};
	int i, j, k;
	bool b;
	char res;
	while (!cin.eof())
	{
		for (i = 0; i < 8; i++)
			cin >> f[i];
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 8; j++)
			{
				for (k = 0; k < 7; k++)
				{
					if (8-j >= p[k].x && 8-i >= p[k].y)
						if (b = c(j, i, p[k]))
							res = 'A' + k;
				}
				if (b) break;
			}
			if (b) break;
		}
		cout << res << endl;
	}
}

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

char mp[8][8];

void ans(char mp[8][8]){
    for(int i = 0 ; i < 8 ; i++){
        for(int j = 0 ; j < 8 ; j++){
            if(mp[i][j]=='1'){
                if(mp[i][j+1]=='1'&&mp[i+1][j]=='1'&&mp[i+1][j+1]=='1'){
                    cout << 'A' << endl;
                    return;
                }
                else if(mp[i+3][j]=='1'){
                    cout << 'B' << endl;
                    return;
                }
                else if(mp[i][j+3]=='1'){
                    cout << 'C' << endl;
                    return;
                }
                else if(mp[i+2][j-1]=='1'){
                    cout << 'D' << endl;
                    return;
                }
                else if(mp[i+1][j+2]=='1'){
                    cout << 'E' << endl;
                    return;
                }
                else if(mp[i+2][j+1]=='1'){
                    cout << 'F' << endl;
                    return;
                }
                else{
                    cout << 'G' << endl;
                    return;
                }
            }
        }
    }
}

int main(){
    while(cin >> mp[0][0]){
        for(int i = 0 ; i < 8 ; i++){
            for(int j = 0 ; j < 8 ; j++){
                if(!i&&!j) continue;
                else cin >> mp[i][j];
            }
        }
        ans(mp);
    }
    
    return 0;
}