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>
using namespace std;
char ma[8][8];

void c(int x,int y){

  if(ma[y+3][x] == '1' && y+3 < 8 )cout << 'B'<<endl;
  else if(ma[y][x+3] == '1' && x+3 < 8)cout << 'C' << endl;
  else if(ma[y+2][x-1] == '1' && y+2 < 8 && x-1 >= 0)cout << 'D' << endl;
  else if(ma[y+1][x+2] == '1' && y+1 < 8 && x+2 < 8)cout << 'E' << endl;
  else if(ma[y+2][x+2] == '1' && y+2 < 8 && x+2 < 8)cout << 'F' << endl;
  else if(ma[y][x+1] == '1' && ma[y+1][x-1] == '1' &&
	  x+1 < 8 && x-1 >= 0 && y+1 < 8)cout << 'G' << endl;
  else cout << 'A' <<endl;

}

int main(){

  while(cin >> ma[0][0]){

    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(i + j == 0)continue;
	cin >> ma[i][j]; 
      }
    }

    int f = 0;
    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(ma[i][j] == '1'){
	  c(j,i);
	  f = 1;
	}
	if(f)break;
      }
    if(f)break;    
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;

char ret;

int main()
{

	while(cin){
	string s;
	
	for(int i=0;i<8;i++){
		string s_tmp;
		cin >>s_tmp;
		s += s_tmp;
	}
	// 2次元配列を1次元的に処理
	for(int i=0;i<8*8;i++){
		if(s[i]=='1'){
			// Aかどうか
			if(s[i+1]=='1' && s[i+8]=='1' && s[i+9]=='1'){
				ret = 'A';
				break;
			}else if(s[i+8]=='1' && s[i+16]=='1' && s[i+24]=='1'){
				ret = 'B';
				break;
			}else if(s[i+1]=='1' && s[i+2]=='1' && s[i+3]=='1'){
				ret = 'C';
				break;
			}else if(s[i+7]=='1' && s[i+8]=='1' && s[i+15]=='1'){
				ret = 'D';
				break;
			}else if(s[i+1]=='1' && s[i+9]=='1' && s[i+10]=='1'){
				ret = 'E';
				break;
			}else if(s[i+8]=='1' && s[i+9]=='1' && s[i+17]=='1'){
				ret = 'F';
				break;
			}else if(s[i+1]=='1' && s[i+7]=='1' && s[i+8]=='1'){
				ret = 'G';
				break;
			}
		}
	}
	
	cout<<ret<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
/*
A 11 B 1 C 1111 D 01 E 110 F 10 G 011
  11   1          11   011   11   110
       1          10         01
       1
*/
int main() {
    string map[8], in;
    while (cin>>in) {
        map[0]=in;
        int h;
        string key[4];
        if (in=="00000000") h=0;
        else {
            key[0]=in;
            h=1;
        }
        for (int i=1; i<8; i++) {
            cin>>map[i];
            if (map[i]!="00000000") key[h++]=map[i];
        }
        if (h==4) cout<<"B"<<endl;
        else if (h==1) cout<<"C"<<endl;
        else if (h==3) {
            bool flag=true;
            for (int i=0; i<8; i++) if (key[1][i]=='1') {
                if (key[0][i]=='1') flag=false;
                break;
            }
            if (flag) cout<<"D"<<endl;
            else cout<<"F"<<endl;
        } else {
            bool flag=true;
            for (int i=0; i<8; i++) if (key[0][i]=='1') {
                if (key[1][i]=='0') flag=false;
                break;
            }
            if (flag) {
                for (int i=0; i<8; i++) if (key[1][i]=='1') {
                    if (key[0][i]=='0') flag=false;
                    break;
                }
                if (flag) cout<<"A"<<endl;
                else cout<<"G"<<endl;
            } else {
                cout<<"E"<<endl;
            }
        }
    }
}

C++: #include <iostream>
using namespace std;
typedef unsigned long long ull;
int main() {
  ull map, shape[] = {0x303, 0x1010101, 0xf, 0x10302, 0x603, 0x20301, 0x306};
  char c, ans;
  int i, j;
  while (cin >> c) {
    map = c - '0';
    for (i = 1; i < 64; i++) {
      cin >> c;
      if (c == '1') map |= (ull) 1 << i;
    }
    for (i = 0; i < 64; i++)
      for (j = 0; j < 7; j++)
        if (((map >> i) & shape[j]) == shape[j]) {
          ans = j + 'A';
          goto p;
        }
    p:
    cout << ans << endl;
  }
}

C++: #include <iostream>

using namespace std;
int main()
{
  string a[8];
  for(;cin>>a[0];)
    {
      for(int i=1;i<8;i++)
	cin>>a[i];
      char n='X';
      for(int i=0;i<8;i++)
	for(int j=0;j<8;j++)
	  if(a[i][j]=='1')
	    {
	      if(i<7&&j<7&&a[i][j+1]=='1' &&a[i+1][j]=='1' &&a[i+1][j+1]=='1')
		n='A';
	      else if(i<5&&a[i+1][j]=='1' &&a[i+2][j]=='1' &&a[i+3][j]=='1')
		n='B';
	      else if(j<5&&a[i][j+1]=='1' &&a[i][j+2]=='1' &&a[i][j+3]=='1')
		n='C';
	      else if(i>0&&j<6&&a[i][j+1]=='1' &&a[i-1][j+1]=='1' &&a[i-1][j+2]=='1')
		n='D';
	      else if(i<7&&j<6&&a[i][j+1]=='1' &&a[i+1][j+1]=='1' &&a[i+1][j+2]=='1')
		n='E';
	      else if(i<6&&j<7&&a[i+1][j]=='1' &&a[i+1][j+1]=='1' &&a[i+2][j+1]=='1')
		n='F';
	      
	      if(n!='X')
		break;
	    }
      if(n=='X')
	n='G';
      cout<<n<<endl;

    }
}