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
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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;
#define rep(i,n) for(int i=0;i<(int)n;i++)
 
int xb[7][3] = {
        {1, 0, 1},
        {0, 0, 0},
        {1, 2, 3},
        {0, -1, -1},
        {1, 1, 2},
        {0, 1, 1},
        {1, 0, -1}
};
 
int yb[7][3] = {
        {0, 1, 1},
        {1, 2, 3},
        {0, 0, 0},
        {1, 1, 2},
        {0, 1, 1},
        {1, 1, 2},
        {0, 1, 1}
};
 
int main() {
        string field[8];
        while(getline(cin, field[0])) {
                for(int i = 1; i < 8; i++) getline(cin, field[i]);
 
                char ans = '\0';
                rep(y,8) {
                        rep(x,8) {
                                if(field[y][x] == '1') {
                                        // cerr << "x: " << x << " " << "y: " << y << endl;
                                        rep(i,8) {
                                                bool f = true;
                                                rep(j,3) {
                                                        int nx = x + xb[i][j];
                                                        int ny = y + yb[i][j];
#if 1
                                                        if(0 <= nx && nx < 8 && 0 <= ny && ny < 8) {
                                                                if(field[ny][nx] != '1') {
                                                                        f = false;
                                                                        break;
                                                                }
                                                        }       
#endif
                                                }
                                                if(f) {
                                                        ans = 'A' + i;
                                                        goto END;
                                                }
                                        }
                                }
                        }
                }
        END:
                cout << ans << endl;
                getline(cin, field[0]);
        }
        return 0;
}

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

int main() {
  char x;
 NEXT:
  while(1) {
    if(cin.eof()) {goto END;}
    cin.get(x);
    if(x == '1') {
      break;
    }
  }
  cin.get(x);
  if(x == '1') {// A,C,E,G
    cin.get(x);
    if(x == '1') // C
      cout << "C" << endl;
    else if(x == '0') {//A,E,G
      for(int i=0;i<6;i++){
        cin.get(x);
      }
      if(x == '1')
        cout << "G" << endl; // G
      else if(x == '0') {
        cin.get(x);
        if(x == '1')
          cout << "A" << endl; // A
        else
          cout << "E" << endl; // E
      }
    }
  }
  else if(x == '0') {//B,D,F
    for(int i=0;i<6;i++) {
      cin.get(x);
    }
    if(x == '1')
      cout << "D" << endl;
    else if(x == '0') {
      cin.get(x);
      cin.get(x);
      if(x == '1')
        cout << "F" << endl;
      else
        cout << "B" << endl;
    }
  }
  while(1){
    cin.get(x);
      if(x == '\n') {
        cin.get(x);
        if(x == '\n')
          goto NEXT;
      }
  }
 END:
  return 0;
}

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

int main()
{
  while (true)
  {
    char board[8][8];
    for (int i=0; i<8; i++)
    {
      for (int j=0; j<8; j++)
      {
        cin >> board[i][j];
      }
    }

    bool flag = false;
    for (int i=0; i<8; i++)
    {
      for (int j=0; j<8; j++)
      {
        if ( board[i][j] == '1' )   //  ブロックがあれば
        {
          if ( board[i+3][j] == '1' )
          {
            cout << 'B' << endl;
          }
          else if ( board[i][j+3] == '1' )
          {
            cout << 'C' << endl;
          }
          else if ( board[i+2][j-1] == '1' )
          {
            cout << 'D' << endl;
          }
          else if ( board[i+1][j+2] == '1' )
          {
            cout << 'E' << endl;
          }
          else if ( board[i+2][j+1] == '1' )
          {
            cout << 'F' << endl;
          }
          else if ( board[i+1][j-1] == '1' )
          {
            cout << 'G' << endl;
          }
          else
          {
            cout << 'A' << endl;
          }
          flag = true;
        }
        if (flag) break;
      }
      if (flag) break;
    }

    char dummy;
    cin >> dummy;
    if ( cin.eof() ) break;
  }
}

C++: #include <iostream>
 
using namespace std;
 
int main(void){
     char field[8][8];
     char tmp;
     int i,j;
	 while(1){
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   cin >> field[i][j];
		 }
	   }
 
	   //それぞれの形について判別
	   //まず左上のマスを探す
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   if(field[i][j] == '1') goto NEXT;
		 }
	   }
	 NEXT:
	   if(j+3 <= 7 && field[i][j+1] == '1' && field[i][j+2] == '1' && field[i][j+3] == '1'){
		 //横一列
		 cout << "C" << endl;
	   }else if(i+3 <= 7 && field[i+1][j]  == '1' && field[i+2][j] == '1' && field[i+3][j] == '1'){
		 //縦一列
		 cout << "B" << endl;
	   }else if(j+1 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j] == '1' && field[i+1][j+1] == '1'){
		 //正方形
		 cout << "A" << endl;
	   }else if(i+2 <= 7 && j+1 <= 7 && field[i+1][j] == '1' && field[i+1][j+1]  == '1' && field[i+2][j+1] == '1'){
		 //1 0
		 //1 1
		 //0 1
		 cout << "F" << endl;
	   }else if(j-1 >= 0 && j+1 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j] == '1' && field[i+1][j-1] == '1'){
		 //0 1 1
		 //1 1 0
		 cout << "G" << endl;
	   }else if(j+2 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j+1]  == '1' && field[i+1][j+2] == '1'){
		 //1 1 0
		 //0 1 1
		 cout << "E" << endl;
	   }else{
		 cout << "D" << endl;
	   }
	   cin.clear();
	   cin.ignore();
	   if(cin.eof()) return 0;
	 }
	 return 0;
}