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;

int main(void){
     char field[8][8];
     char tmp;
     int i,j;
    
     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>
#include <string>
using namespace std;

string M[15];

int main() {

  for(int i=1; i<15; i++) M[i] = "                    ";
  
  while(cin>>M[0]) {
    for(int i=1; i<8; i++) cin >> M[i];
    
    char res = '#';
    
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(M[i][j]-'0') {
	  
	  if(M[i+1][j+1]-'0') {
	    if(M[i+2][j+1]-'0') {
	      res = 'F'; goto end;
	    } else if(M[i+1][j+2]-'0') {
	      res = 'E'; goto end;
	    } else {
	      res = 'A'; goto end;
	    }
	  }
	  
	  if(M[i+3][j]-'0') {
	    res = 'B'; goto end;
	  }

	  if(M[i][j+3]-'0') {
	    res = 'C'; goto end;
	  }

	  if(M[i-1][j+2]-'0') {
	    res = 'D'; goto end;
	  }

	  if(M[i+1][j-1]-'0') {
	    res = 'G'; goto end;
	  }
	  
	}
      }
    }
    end:
    cout << res << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
 
int main()
{
    char s[16][16]={0};
    while(cin >> s[0])
    {
        int y,x; char c;
        for(y=1; y<8; y++)
        cin >> s[y];
 
        for(y=0; y<8; y++)
        for(x=0; x<8; x++)
        s[y][x]-='0';
 
        for(y=0; y<64; y++)
        if(s[y/8][y%8])break;
 
        x=y%8; y/=8;
 
             if(s[y+3][x  ]) c='B';
        else if(s[y  ][x+3]) c='C';
        else if(s[y+1][x+2]) c='E';     
        else if(s[y+2][x+1]) c='F';
        else if(s[y+1][x+1]) c='A';
        else if(s[y  ][x+1]) c='G';
        else                 c='D';
 
        cout << c << endl;
    }
}

C++: #include <iostream>

using namespace std;

int main(void){
    int list_x[7][3]={{1,0,1},{0,0,0},{1,2,3},{0,-1,-1},{1,1,2},{0,1,1},{1,0,-1}};
    int list_y[7][3]={{0,1,1},{1,2,3},{0,0,0},{1,1,2},{0,1,1},{1,1,2},{0,1,1}};
    int i,j;
    int k,l;
    int fig_i;
    char fig[8]={"ABCDEFG"};
    char s[8][9];
    bool judge;
    
    while(true){
        judge=false;
        for(i=0;i<8;i++){
            if(!(cin>>s[i]))return(0);
            cin.get();
        }
        for(i=0;i<8;i++){
            for(j=0;j<8;j++){
                if(s[i][j]=='1'){
                    for(k=0;k<7;k++){
                        judge=true;
                        for(l=0;l<3;l++){
                            if(s[i+list_y[k][l]][j+list_x[k][l]]!='1'){
                                judge=false;
                            }
                        }
                        if(judge){
                            fig_i=k;
                            break;
                        }
                    }
                }
                if(judge)break;
            }
            if(judge)break;
        }
        cout<<fig[fig_i]<<endl;
    }
}