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>
#include <string>
using namespace std;
int main(){
 int b[5][4];
 int sx,sy;
 int x,y;
 string line;
 while(true){
 for(int i=0;i<20;i++)b[i%5][i/5] = 0;
 sx=sy=-1;
 for(y=0;y<8;y++){
 if (!(cin>>line))break;
 for(x=0;x<8;x++){
 if (line[x]=='1'){
 if (sy==-1){sx=x-1;sy=y;}
 b[x-sx][y-sy] = 1;
 }
 }
 }
 if (y<8)break;
 if(b[2][0]&&b[1][1]&&b[2][1])cout<<"A"<<endl;
 if(b[1][3])cout<<"B"<<endl;
 if(b[4][0])cout<<"C"<<endl;
 if(b[0][2])cout<<"D"<<endl;
 if(b[3][1])cout<<"E"<<endl;
 if(b[2][2])cout<<"F"<<endl;
 if(b[0][1]&&b[2][0])cout<<"G"<<endl;
 }}

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

struct ca {
	int x;
	int y;
};

int main() {
	ca l[4];
	while (cin)
	{
		int a = 0;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				char c;
				cin >> c;
				if (c == '1')
				{
					l[a].x = i;
					l[a].y = j;
					a++;
				}
			}
		}
		int x = l[0].x;
		int y = l[0].y;
		if (l[1].x == x&&l[1].y == y + 1) {
			//[l0][l1]
			//ACEG
			if (l[3].x == x + 1 && l[3].y == y + 1)
				cout << 'A';
			else if (l[3].y == y + 3)
				cout << 'C';
			else if (l[3].x == x + 1 && l[3].y == y + 2)
				cout << 'E';
			else cout << 'G';
		}
		else if (l[1].x == x + 1 && l[1].y == y) {
			/*[l0]
			  [l1]*/
			  //BF
			if (l[3].x == x + 3 && l[3].y == y)
				cout << 'B';
			else cout << 'F';
		}
		else cout << 'D';
		cout << endl;
	}
	char c;
	cin >> c;
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	while (cin >> s) {
		vector<string>v;
		v.push_back(s);
		rep(i, 0, 7) {
			string t; cin >> t;
			v.push_back(t);
		}
		char ans;
		rep(i, 0, 8) {
			rep(j, 0, 8) {
				if (v[i][j] == '1') {
					if (j + 1 < 8 && i + 1 < 8 && v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1')ans = 'A';
					else if (i + 3 < 8 && v[i + 1][j] == '1'&&v[i + 2][j] == '1'&&v[i + 3][j] == '1')ans = 'B';
					else if (j + 3 < 8 && v[i][j + 1] == '1'&&v[i][j + 2] == '1'&&v[i][j + 3] == '1')ans = 'C';
					else if (i + 1 < 8 && j + 2 < 8 && v[i][j + 1] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 1][j + 2] == '1')ans = 'E';
					else if (i + 2 < 8 && j + 1 < 8 && v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 2][j + 1] == '1')ans = 'F';
					else if (i + 2 < 8 && j - 1 >= 0 && v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1'&&v[i + 2][j - 1] == '1')ans = 'D';
					else if (i - 1 >= 0 && i + 1 < 8 && j + 1 < 8 && v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i - 1][j - 1] == '1')ans = 'G';
					goto here;
				}
			}
		}
	here:;
		cout << ans << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
long i,n,n2,f;
while(cin>>n){
i=2;
while(n==0){cin>>n;i++;}
if(i==9)f=2;
else{
cin>>n2;
if(n2==0)f=2;
else if(n2==n){if(n%11==0)f=0;else f=1;}
else if(n2==n*11)f=3;
else if(n2==n/10)f=4;
else if(n2==n*10)f=6;
else f=5;
for(;i<8;i++)cin>>n;
}
cout<<"ABCDEFG"[f]<<endl;
}
return 0;
}

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

void Select_Figure( char s[14][14] )
{
    for( int i = 3; i < 11; i++ )
    {
        for( int j = 3; j < 11; 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;
                else if ( s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1' )
                    cout << 'B' << endl;
                else if ( s[i][j+1] == '1' && s[i][j+2] == '1' && s[i][j+3] == '1' )
                    cout << 'C' << endl;
                else if ( s[i+1][j] == '1' && s[i+1][j-1] == '1' && s[i+2][j-1] == '1' )
                    cout << 'D' << endl;
                else if ( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1' )
                    cout << 'E' << endl;
                else if ( s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1' )
                    cout << 'F' << endl;
                else if ( s[i][j+1] == '1' && s[i+1][j] == '1' && s[i+1][j-1] == '1' )
                    cout << 'G' << endl;
                else;
                return;
            }
        }
    }
}

int main()
{
    char s[14][14];         //数字の間に区切りが無いからchar型で読み込む。大事。
    
    for( int k = 0; k < 50; k++ )
    {
        //初期化
        for( int i = 0; i < 14; i++ )
            for( int j = 0; j < 14; j++ )
                s[i][j] = 0;
        
        for( int i = 3; i < 11; i++ )
            for( int j = 3; j < 11; j++ )
                cin >> s[i][j];
            
        Select_Figure( s );
    }

    return 0;
}