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 N 8

int ptn[7]={18, 48, 6, 30, 20, 34, 16};

int main(void){
    string str,tmp;
	while (true){
		int i=0;
		getline(cin,tmp);
		if (cin.eof()) break;
		if (tmp.length()>0){
			str = tmp;
			i++;
		}else str = "";

		while (i<N){
			getline(cin,tmp);
			str+=tmp;
			i++;
		}
		int s=0, mini=(int)str.length();
		for (int i=0; i<str.length(); i++){
			if (str[i]=='1'){
				if (i<mini) mini =i;
				s+=i;
			}
		}
		s -= mini*4;
		for (int i=0; i<7; i++){
			if (ptn[i]==s){ 
				cout<<char(i+'A')<<endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    string f[8];
    while (cin >> f[0]) {
        for (int i = 1; i < 8; i++) {
            cin >> f[i];
        }

        int num = -1;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (f[i][j] == '0') continue;
                
                if (i + 1 < 8 && j + 1 < 8) {                    
                    if (f[i][j+1] == '1' &&
                        f[i+1][j] == '1' && f[i+1][j+1] == '1') {
                        num = 0;
                        break;
                    }
                }
                
                if (i + 3 < 8) {
                    if (f[i+3][j] == '1') {
                        num = 1;
                        break;
                    }
                }
                
                if (j + 3 < 8) {
                    if (f[i][j+3] == '1') {
                        num = 2;
                        break;
                    }
                }
                
                if (i + 2 < 8 && j - 1 >= 0) {
                    if (f[i+2][j-1] == '1') {
                        num = 3;
                        break;
                    }
                }

                if (i + 1 < 8 && j + 2 < 8) {
                    if (f[i+1][j+2] == '1') {
                        num = 4;
                        break;
                    }
                }

                if (i + 2 < 8 && j + 1 < 8) {
                    if (f[i+2][j+1] == '1') {
                        num = 5;
                        break;
                    }
                }

                if (i + 1 < 8 && j - 1 >= 0) {
                    if (f[i+1][j-1] == '1') {
                        num = 6;
                        break;
                    }
                }
            }
            if (num != -1) break;
        }
        cout << (char)('A' + num) << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
     char field[8][8];
     char tmp;
     int i,j;
	 while(1){
	   if(cin.eof()) return 0;
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   cin >> field[i][j];
		 }
	   }
	   
	   //»ê¼êÌ`ÉÂ¢Ä»Ê
	   //Ü¸¶ãÌ}XðT·
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   if(field[i][j]) goto NEXT;
		 }
	   }
	   
     NEXT:
	   if(field[i][j+1] && field[i][j+2] && field[i][j+3]){
		 //¡êñ
		 cout << "C" << endl;
	   }else if(field[i+1][j] && field[i+2][j] && field[i+3][j]){
		 //cêñ
		 cout << "B" << endl;
	   }else if(field[i][j+1] && field[i+1][j] && field[i+1][j+1]){
		 //³û`
		 cout << "A" << endl;
	   }else if(field[i+1][j] && field[i+1][j+1] && field[i+2][j+1]){
		 //1 0
		 //1 1
		 //0 1
		 cout << "F" << endl;
	   }else if(field[i][j+1] && field[i+1][j] && field[i+1][j-1]){
		 //0 1 1
		 //1 1 0
		 cout << "G" << endl;
	   }else if(field[i][j+1] && field[i+1][j+1] && field[i+1][j+2]){
		 //1 1 0
		 //0 1 1
		 cout << "E" << endl;
	   }else{
		 cout << "D" << endl;
	   }
	 }
	 return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	char c[10][10];
    while (cin>>c[0][0]){
        for (int i = 0; i < 8; i++)
            for (int j = 0; j < 8; j++){
                if(i==0&&j==0)continue;
                cin >> c[i][j];}
        int a, b;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (c[i][j] == '1') {
                    a = i;
                    b = j;
                    goto C;
                }
            }
        }
    C:
        if (c[a][b + 1] == '1') {
            if (c[a + 1][b] == '1') {
                if (c[a + 1][b + 1] == '1')
                    cout << 'A';
                else cout << 'G';
            }
            else {
                if (c[a + 1][b + 1] == '1')
                    cout << 'E';
                else cout << 'C';
            }
        }
        else if (c[a + 1][b + 1] == '1')
            cout << 'F';
        else if (c[a + 1][b - 1] == '1')
            cout << 'D';
        else cout << 'B';
        cout << endl;
    }
    return 0;
}

C++: #include<stdio.h>

int main(){
char C[10];
char ch[9][9]={};
int x=0,y=0;
bool f=true;
while(scanf("%s",C)!=EOF){
	bool F=true;
	for(int i=0;i<8;i++)
		{ch[0][i]=C[i];if(ch[0][i]=='1'&&F==true){x=i;y=0;F=false;}
	}
for(int i=1;i<8;i++){
	scanf("%s",C);
for(int j=0;j<9;j++)
{char cc;
	//if(j==8)scanf("%c",&cc);
ch[i][j]=C[j];
if(ch[i][j]=='1'&&F==true){x=j;y=i;F=false;}
if(ch[i][j]==EOF)f=false;}
}

	

if(ch[y][x+1]=='1'&&ch[y+1][x]=='1'&&ch[y+1][x+1]=='1')printf("A\n");

if(ch[y+1][x]=='1'&&ch[y+2][x]=='1'&&ch[y+3][x]=='1')printf("B\n");

if(ch[y][x+1]=='1'&&ch[y][x+2]=='1'&&ch[y][x+3]=='1')printf("C\n");

if(ch[y+2][x-1]=='1'&&ch[y+1][x]=='1')printf("D\n");

if(ch[y][x+1]=='1'&&ch[y+1][x+2]=='1')printf("E\n");

if(ch[y+1][x]=='1'&&ch[y+2][x+1]=='1')printf("F\n");

if(ch[y][x+1]=='1'&&ch[y+1][x-1]=='1')printf("G\n");
/*
if(f==false)break;
}*/
}
return 0;
}