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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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;
char str[9][9];
int mx[4]={1,0,-1,0},my[4]={0,1,0,-1},moving[4];
void serch(int mo,int y,int x)
{
    for(int i=0;i<4;i++){
            if(str[my[i]+y][x+mx[i]]=='1'&&my[i]+y>=0&&my[i]+y<9&&mx[i]+x>=0&&mx[i]+x<9){
                str[my[i]+y][x+mx[i]]='0';
                moving[mo]=i;
                serch(mo+1,y+my[i],x+mx[i]);
            }

    }
}
int main()
{
    int co=0;
    while(cin>>str[0]){
        for(int i=1;i<8;i++)cin>>str[i];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(str[i][j]=='1'&&co==0){
                    str[i][j]='0';
                    serch(0,i,j);
                    co=1;
                    break;
                }
                else if(str[i][j]=='1'&&co==1)co++;
            }
        }
        if(moving[0]==0&&co!=2){
            if(moving[1]==1){
                if(moving[2]==2)cout<<"A"<<endl;
                else cout<<"E"<<endl;
            }
            else cout<<"C"<<endl;
        }
        else if(moving[0]==1&&co!=2){
            if(moving[1]==0)cout<<"F"<<endl;
            else if(moving[1]==1)cout<<"B"<<endl;
            else cout<<"D"<<endl;
        }
        else cout<<"G"<<endl;
        co=0;
    }
}

C++: #include <cstdio>
#include <algorithm>
using namespace std;
char imap[8][9];
static pair<int, int> forms[7][3] = {
    {{0, 1}, {1, 0}, {0, -1}},
    {{1, 0}, {1, 0}, {1, 0}},
    {{0, 1}, {0, 1}, {0, 1}},
    {{1, 0}, {0, -1}, {1, 0}},
    {{0, 1}, {1, 0}, {0, 1}},
    {{1, 0}, {0, 1}, {1, 0}},
    {{0, 1}, {1, -1}, {0, -1}}
};
static char decoder[7] = {'A', 'B', 'C', 'D', 'E', 'F', 'G'};
int res;

bool search(int x, int y, int t) {
    bool isFound = true;
    for (int i = 0; i < 3; i++) {
        x += forms[t][i].first, y += forms[t][i].second;
        if (x < 0 || x > 7 || y < 0 || y > 7 || imap[x][y] != '1') { isFound = false; break; }
    }
    return isFound;
}

void solve() {
    bool flag = false;
    res = -1;
    for (int i = 0; i < 8; i++) {
        if (res > -1) break;
        for (int j = 0; j < 8; j++) {
            if (imap[i][j] == '0') continue;
            for (int k = 0; k < 7; k++) {
                if (search(i, j, k)) { res = k; break;}
            }
            break;
        }
    }
}



int main(){

    while(scanf("%s", imap[0]) != EOF) {
        for (int i = 1; i < 8; i++) {
            scanf("%s", imap[i]);
        }
        solve();
        printf("%c\n", decoder[res]);
    }
    return 0;
}

C++: #include <iostream>
#include <utility>
using namespace std;
typedef pair<int,int> P;
int main(){
	int a;
	char board[8][9];
	P l[4];
	while(cin >> board[0]){
		a = 0;
		for(int i = 1;i < 8;++i){
			cin >> board[i];
		}
		for(int i = 0;i < 8;++i){
			for(int j = 0;j < 8;++j){
				if(board[i][j] == '1'){
					l[a].first = j;
					l[a].second = i;
					++a;
				}
			}
		}
		if(l[3].first - l[0].first == 3){
			cout << 'C' << endl;
		}
		else if(l[3].second - l[0].second == 3){
			cout << 'B' << endl;
		}
		else if(l[3].second - l[0].second == l[3].first - l[0].first){
			cout << 'A' << endl;
		}
		else if(l[0].first == l[3].first){
			cout << 'G' << endl;
		}
		else if(l[3].first - l[0].first == 2){
			cout << 'E' << endl;
		}
		else if(l[3].first - l[0].first == -1){
			cout << 'D' << endl;
		}
		else cout << 'F' << endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int board[8][9];//y,xの順番

char data[10];

int isA(int x,int y){

	if(y==7 || x == 7){
		return 0;
	}
	if(board[y][x+1] == 1 && board[y+1][x+1] == 1 && board[y+1][x] == 1){
		return 1;
	}

	return 0;
}

int isB(int x,int y){
	if(y>=5){
		return 0;
	}
	else if(board[y+1][x]==1 && board[y+2][x] == 1 && board[y+3][x]==1){
		return 1;
	}

	return 0;
}

int isC(int x,int y){
	if(x>=5){
		return 0;
	}
	else if(board[y][x+1]==1 && board[y][x+2] == 1 && board[y][x+3]==1){
		return 1;
	}

	return 0;
}

int isD(int x,int y){
	if(y>=6 || x==0){
		return 0;
	}
	else if(board[y+1][x]==1 && board[y+2][x-1] == 1 && board[y+1][x-1]==1){
		return 1;
	}

	return 0;
}

int isE(int x,int y){
	if(x>=6 || y == 7){
		return 0;
	}
	else if(board[y][x+1]==1 && board[y+1][x+1] == 1 && board[y+1][x+2]==1){
		return 1;
	}

	return 0;
}

int isF(int x,int y){
	if(y>=6 || x==7){
		return 0;
	}
	else if(board[y+1][x]==1 && board[y+1][x+1] == 1 && board[y+2][x+1]==1){
		return 1;
	}

	return 0;
}

int isG(int x,int y){
	if(y==0 || x>=6){
		return 0;
	}
	else if(board[y][x+1]==1 && board[y-1][x+1] == 1 && board[y-1][x+2]==1){
		return 1;
	}

	return 0;
}

void dataChange(int i){
	for(int j=0;j<8;j++){
		board[i][j] = data[j] - '0';
	}
}

int main(){

	while(cin>>data){
		dataChange(0);

		for(int i=1;i<8;i++){
			cin>>data;
			dataChange(i);
		}

		for(int y=0;y<8;y++){
			for(int x=0;x<8;x++){
				if(board[y][x] == 1){
					if(isA(x,y) == 1){
						cout<<"A"<<endl;
					}
				}

				if(board[y][x] == 1){
					if(isB(x,y) == 1){
						cout<<"B"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isC(x,y) == 1){
						cout<<"C"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isD(x,y) == 1){
						cout<<"D"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isE(x,y) == 1){
						cout<<"E"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isF(x,y) == 1){
						cout<<"F"<<endl;
					}
				}
				if(board[y][x] == 1){
					if(isG(x,y) == 1){
						cout<<"G"<<endl;
					}
				}
			}
		}
	}

	return 0;
}