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++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

char s[18][18];
string buf;
int main(){
	do{
		memset(s,0,sizeof(s));
		for(int i=1;i<=8;i++)scanf("%s",s[i]+1);
		for(int i=1;i<=8;i++){
			for(int j=1;j<=8;j++){
				if(s[i][j]!='1')continue;
				if(s[i][j+1]=='1'&&s[i+1][j+1]=='1'&&s[i+1][j]=='1'){puts("A");goto p;}
				if(s[i+1][j]=='1'&&s[i+2][j]=='1'&&s[i+3][j]=='1'){puts("B");goto p;}
				if(s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i][j+3]=='1'){puts("C");goto p;}
				if(s[i+1][j-1]=='1'&&s[i+1][j]=='1'&&s[i+2][j-1]=='1'){puts("D");goto p;}
				if(s[i][j+1]=='1'&&s[i+1][j+1]=='1'&&s[i+1][j+2]=='1'){puts("E");goto p;}
				if(s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j+1]=='1'){puts("F");goto p;}
				if(s[i][j+1]=='1'&&s[i+1][j-1]=='1'&&s[i+1][j]=='1'){puts("G");goto p;}
			}
		}
		p:
	}while(getline(cin,buf));
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
char w[8][8];
int dx[]={0,0,1,-1},dy[]={1,-1,0,0},s[8][8],q[4];
//ツ湘」ツ、ツ可コツ、ツ右ツ、ツ債カ
void func(int y,int x){
	s[y][x]=0;
	for(int i=0;i<4;i++)
	if(y+dy[i]>=0&&y+dy[i]<8&&x+dx[i]>=0&&x+dx[i]<8)
	if(s[y+dy[i]][x+dx[i]]==1){
		
		q[i]++;
		func(y+dy[i],x+dx[i]);
	}
}
int main(){
	while(scanf("%s",w[0])!=EOF){
		for(int i=1;i<8;i++)
			scanf("%s",w[i]);
		for(int i=0;i<8;i++)
		for(int j=0;j<8;j++)
		s[i][j]=w[i][j]-'0';
		
		for(int i=0;i<4;i++)
			q[i]=0;
		for(int i=0;i<8;i++)
		for(int j=0;j<8;j++)
		if(s[i][j]==1)
		func(i,j);
		if(q[0]==1&&q[1]==1&&q[2]==1)
	cout<<'A'<<endl;
else if(q[0]==3)
	cout<<'B'<<endl;
else if(q[2]==3)
	cout<<'C'<<endl;
else if(q[0]==2&&q[3]==1)
	cout<<'D'<<endl;
else if(q[0]==1&&q[2]==2)
	cout<<'E'<<endl;
else if(q[0]==2&&q[2]==1)
	cout<<'F'<<endl;
else if(q[0]==1&&q[2]==1&&q[3]==1)
	cout<<'G'<<endl;
		
		
	}
	return 0;
}

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

int ary[128];
int kat[7][3]={{1,8,9},{8,16,24},{1,2,3},{7,8,15},{1,9,10},{8,9,17},{1,7,8}};
int main(){
	while(true){
		char ch;
		for(int i=0;i<64;i++){
			cin>>ch;
			ary[i]=ch-'0';
		}
		if(cin.eof()) break;
		int res=-1;
		for(int i=0;i<64;i++){
			if(ary[i]){
				for(int j=0;j<7;j++){
					bool fla=true;
					for(int k=0;k<3;k++){
						if(!ary[i+kat[j][k]]) fla=false;
					}
					if(fla){
						res=j;
						goto aaa;
					}
				}
			}
		}
aaa:
		cout<<(char)('A'+res)<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

char mass[16][16];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    bool f;
    
    while (!cin.eof()) {
        f = false;
        
        rep(i, 16) {
            rep(j, 16) {
                mass[i][j] = '0';
            }
        }

        rep(i, 8) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
  
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
#define debug(x) cout << #x << " = " << (x) << endl;
  
using namespace std;
  
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

vector<string> v(8);

char check(int y, int x){
	if(x < 0 || x >= 8 || y < 0 || y >= 8) return '0';
	return v[y][x];
}

int main(){
	vector<string> fig(7);
	fig[0] = "110110000";
	fig[1] = "100100100";
	fig[2] = "111000000";
	fig[3] = "100100000";
	fig[4] = "110011000";
	fig[5] = "100110010";
	fig[6] = "110100000";

	while(1){
		rep(i, 8) if(!(cin >> v[i])) return 0;

		rep(i, 8){
			rep(j, 8){
				if(v[i][j] != '1') continue;
				string s;
				for(int k = 0; k < 3; k++){
					for(int l = 0; l < 3; l++){
						s += check(i+k, j+l);
					}
				}
				rep(k, fig.size()){
					if(s == fig[k]){
						cout << "ABCDEFG"[k] << endl;
						goto nextloop;
					}
				}
			}
		}
nextloop:
		;
	}

	return 0;
}