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;

string s[8];

int check( int i , int j ){

  if( i + 1 < 8 && j + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j] == '1' ){
      return 1;
    }
  }
  if( i + 3 < 8 ){
    if( s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1' ){
      return 2;
    }
  }
  if( j + 3 < 8 ){
    if( s[i][j+1] == '1' && s[i][j+2] == '1' && s[i][j+3] == '1' ){
      return 3;
    }
  }
 if( j - 1 >= 0 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j-1] == '1' && s[i+2][j-1] == '1' ){
      return 4;
    }
  }
 if( j + 2 < 8 && i + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1' ){
      return 5;
    }
  }
  if( j + 1 < 8 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1' ){
      return 6;
    }
  }
  return 7;
}

int main(void){
  
  while( cin >> s[0] ){

    for( int i = 1 ; i < 8 ; i++ ){
	cin >> s[i];
    }

    for( int i = 0 ; i < 8 ; i++ ){
      for( int j = 0 ; j < 8 ; j++ ){
	if( s[i][j] == '1' ){
	  //  cout << i << j << "---" <<  endl;
	  switch( check( i , j ) ){
	  case 1:
	    cout << "A" << endl;
	    break;
	  case 2:
	    cout << "B" << endl;
	    break;
	  case 3:
	    cout << "C" << endl;
	    break;
	  case 4:
	    cout << "D" << endl;
	    break;
	  case 5:
	    cout << "E" << endl;
	    break;
	  case 6:
	    cout << "F" << endl;
	    break;
	  case 7:
	    cout << "G" << endl;
	    break;
	  }
	  goto end;
	}
      }
    }
   end:;
  }
  return 0;
}

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

int main()
{
    char field[11][11];
    string r;
    int i,j;
    do {
	for (i=0; i<8; i++)
	{
	    scanf("%s",field[i]);
	}
	for (i=0; i<8; i++)
	{
	    for (j=0; j<8; j++)
	    {
		if (field[i][j] == '1')goto b;
	    }
	}
    b:
	if (field[i][j+1] == '1')
	{
	    if (field[i][j+2] == '1')
		r="C";
	    else if (field[i+1][j] == '1')
		r="A";
	    else
		r="E";
	} else {
	    if (field[i+2][j] == '1')
		r="B";
	    else if (field[i+1][j+1] == '1')
		r="F";
	    else
		r="D";
	}
	cout << r << endl;
    } while (getline() != NULL);
    return 0;
}

C++: #include <iostream>
main(){int b[5][4],s,t,x,y;char l[8];for(;;){for(int i=0;i<20;i++)b[i%5][i/5]=0;s=t=9;for(y=0;y<8;y++){if(!(std::cin>>l))break;for(x=0;x<8;x++){if(l[x]=='1'){if(t==9){s=x-1;t=y;}b[x-s][y-t]=1;}}}if(y<8)break;char a=65;if(b[1][3])a=66;if(b[4][0])a=67;if(b[0][2])a=68;if(b[3][1])a=69;if(b[2][2])a=70;if(b[0][1]&&b[2][0])a=71;std::cout<<a<<"\n";}}

C++: #include<iostream>
using namespace std;
typedef unsigned long long ull;
int main(){
	int shape[7]={0x0303,0x01010101,0x0f,
		0x010302,0x0603,0x020301,0x0306};
	while(!cin.eof()){
		int ans=-1;
		ull mass=0;	
		for(int i=0;i<64;i++){
			char c;
			cin>>c;
			if(c=='1')mass |= (ull)1<<i; 
		}
		for(int i=0;i<64;i++){
			for(int j=0;j<7;j++){
				if((mass>>i&shape[j])==shape[j])ans=j;
			}
		}
		cout<<(char)(ans+'A')<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
int main (int argc, char const* argv[]) {
  while (true) {
    char map[8][9];
    memset(map, '0', sizeof map);
    if (EOF == scanf("%s",map[0])) break;
    for (int i=1;i<8;i++) scanf("%s",map[i]);
    
    for (int i = 0; i < 8; i += 1) {
      for (int j = 0; j < 8; j += 1) {
        if (map[i][j] == '1') {
          // A
          if (i < 7 && j < 7) {
            if (map[i][j+1]=='1'&&map[i+1][j]=='1'&&map[i+1][j+1]=='1') {
              cout<<"A"<<endl;
              goto out;
            }
          }
          // B
          if (i < 5) {
            if (map[i+1][j]=='1'&&map[i+2][j]=='1'&&map[i+3][j]=='1') {
              cout<<"B"<<endl;
              goto out;
            }
          }
          // C
          if (j < 5) {
            if (map[i][j+1]=='1'&&map[i][j+2]=='1'&&map[i][j+3]=='1') {
              cout<<"C"<<endl;
              goto out;
            }
          }
          // D
          if (i < 6) {
            if (map[i+1][j]=='1'&&map[i-1][j-1]=='1'&&map[i-2][j-1]=='1') {
              cout<<"D"<<endl;
              goto out;
            }
          }
          // E
          if (i < 7 && j < 6) {
            if (map[i][j+1]=='1'&&map[i+1][j+1]=='1'&&map[i+1][j+2]=='1') {
              cout<<"E"<<endl;
              goto out;
            }
          }
          // F
          if (i < 6 && j < 7) {
            if (map[i+1][j]=='1'&&map[i+1][j+1]=='1'&&map[i+2][j+1]=='1') {
              cout<<"F"<<endl;
              goto out;
            }
          }
          // G
          if (i < 7 && j < 5) {
            if (map[i][j+1]=='1'&&map[i+1][j]=='1'&&map[i+1][j-1]=='1') {
              cout<<"G"<<endl;
              goto out;
            }
          }
        }
      }
    }
    out:;
    //scanf("%s",map[0]);
  }
  return 0;
}