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 <stdio.h>

int main(void)
{
	int field[8][8]={0};
	int i, j;
	int judge[7];



	for( j = 0 ; j < 8 ; j++ ){
		for( i = 0 ; i < 8 ; i++ ){
			scanf("%d",&field[i][j]);
		}
	}

	for( j = 0 ; j < 8 ; j++ ){
		for( i = 0 ; i < 8 ; j++ ){

									if(field[i][j] == 1){
									judge[0] += 1;
									judge[1] += 1;
									judge[2] += 1;
									judge[3] += 0;
									judge[4] += 1;
									judge[5] += 1;
									judge[6] += 0;}
									if(field[i][j+1] == 1){
									judge[0] += 1;
									judge[1] += 1;
									judge[2] += 0;
									judge[3] += 1;
									judge[4] += 0;
									judge[5] += 1;
									judge[6] += 1;}
									if(field[i+1][j] == 1){
									judge[0] += 1;
									judge[1] += 0;
									judge[2] += 1;
									judge[3] += 1;
									judge[4] += 1;
									judge[5] += 0;
									judge[6] += 1;}
									if(field[i+1][j+1] == 1){
									judge[0] += 1;
									judge[1] += 0;
									judge[2] += 0;
									judge[3] += 1;
									judge[4] += 1;
									judge[5] += 1;
									judge[6] += 1;}
									if(field[i][j+2] == 1){
									judge[0] += 0;
									judge[1] += 1;
									judge[2] += 0;
									judge[3] += 1;
									judge[4] += 0;
									judge[5] += 0;
									judge[6] += 0;}
									if(field[i+2][j] == 1){
									judge[0] += 0;
									judge[1] += 0;
									judge[2] += 1;
									judge[3] += 0;
									judge[4] += 0;
									judge[5] += 0;
									judge[6] += 1;}
									if(field[i+1][j+2] == 1){
									judge[0] += 0;
									judge[1] += 0;
									judge[2] += 0;
									judge[3] += 0;
									judge[4] += 0;
									judge[5] += 1;
									judge[6] += 0;}
									if(field[i+2][j+1] == 1){
									judge[0] += 0;
									judge[1] += 0;
									judge[2] += 0;
									judge[3] += 0;
									judge[4] += 1;
									judge[5] += 0;
									judge[6] += 0;}
									if(field[i+3][j] == 1){
									judge[0] += 0;
									judge[1] += 0;
									judge[2] += 1;
									judge[3] += 0;
									judge[4] += 0;
									judge[5] += 0;
									judge[6] += 0;}
									if(field[i][j+3] == 1){
									judge[0] += 0;
									judge[1] += 1;
									judge[2] += 0;
									judge[3] += 0;
									judge[4] += 0;
									judge[5] += 0;
									judge[6] += 0;}

	if(judge[0] == 4){
		printf("A");
		return 0;}
	if(judge[1] == 4){
		printf("B");
		return 0;}
	if(judge[2] == 4){
		printf("C");
		return 0;}
	if(judge[3] == 4){
		printf("D");
		return 0;}
	if(judge[4] == 4){
		printf("E");
		return 0;}
	if(judge[5] == 4){
		printf("F");
		return 0;}
	if(judge[6] == 4){
		printf("G");
		return 0;}
		
									judge[0] = 0;
									judge[1] = 0;
									judge[2] = 0;
									judge[3] = 0;
									judge[4] = 0;
									judge[5] = 0;
									judge[6] = 0;
		
		}
	}





}

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

int ax[7] = {2, 1, 4, 2, 3, 2, 3};
int ay[7] = {2, 4, 1, 3, 2, 3, 2};
int a[7][4][4] = {
  {
    {1, 1},
    {1, 1},
  },
  {
    {1},
    {1},
    {1},
    {1},
  },
  {
    {1, 1, 1, 1},
  },
  {
    {0, 1},
    {1, 1},
    {1, 0},
  },
  {
    {1, 1, 0},
    {0, 1, 1},
  },
  {
    {1, 0},
    {1, 1},
    {0, 1},
  },
  {
    {0, 1, 1},
    {1, 1, 0},
  },
};

string p[8];
int main()
{
  char tmp;
  do
  {
    for(int i = 0; i < 8; i++)
      cin >> p[i];
    for(int i = 0; i < 7; i++)
    {
      for(int y = 0; y < 8 - ay[i]; y++)
      {
        for(int x = 0; x < 8 - ax[i]; x++)
        {
          for(int yy = 0; yy < ay[i]; yy++)
          {
            for(int xx = 0; xx < ax[i]; xx++)
            {
              if(p[y + yy][x + xx] - '0' != a[i][yy][xx])
                goto aaa;
            }
          }
          cout << (char)('A' + i) << endl;
          goto bbb;
aaa:;
        }
      }
    }
bbb:;
  } while(cin >> tmp);
}

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 A[7][4][4]={
  
  {
    {1,1,0,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
  },
  
  {
    {1,1,1,1},
    {0,0,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,0,0},
    {1,1,0,0},
    {1,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,1,0,0},
    {0,1,1,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,1,0,0},
    {0,1,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,1,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
},
  
  a[12][12];

string s="ABCDEFG";

void check(){


  for(int n=0;n<7;n++){

    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	bool fg=true;
	for(int k=0;k<4;k++){
	  for(int l=0;l<4;l++){
	    if(a[i+k][j+l]!=A[n][k][l]){
	      fg=false;
	      break;
	    }
	  }
	}
	if(fg){
	cout << s[n] << endl;
	  return;
	}
	fg=true;

      }
    }
  }

}


int main(void){

  char ch;

  while(true){

    for(int i=0;i<12;i++)
      for(int j=0;j<12;j++)
	a[i][j]=0;
    
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	cin.get(ch);
	if(cin.eof())return 0;
	a[i][j]=ch-'0';
      }
      cin.ignore();
    }
    check();
  }

  return 0;
}