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 <cstdio>

using namespace std;

typedef struct _XY {
	int x;
	int y;
} XY;

XY figure[][4] = {
	{{1, 0}, {0, 1}, {1, 1}}, // A
	{{0, 1}, {0, 2}, {0, 3}}, // B
	{{1, 0}, {2, 0}, {3, 0}}, // C
	{{0, 1}, {-1, 1}, {-1, 2}}, // D
	{{1, 0}, {1, 1}, {2, 1}}, // E
	{{0, 1}, {1, 1}, {1, 2}}, // F
	{{1, 0}, {0, 1}, {-1, 1}}, // G
};

string name[7] = {"A", "B", "C", "D", "E", "F", "G"};
int main() {
	int math[8][8];
	char c;
	while (1) {
		memset(math, 0, sizeof(math));
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				c = getchar();
				math[i][j] = c - '0';
			}
			c = getchar();
		}

//		for (int i = 0; i < 8; i++) {
//			for (int j = 0; j < 8; j++) {
//				cout << math[i][j];
//			}
//			cout << endl;
//		}

		XY p;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (math[i][j] == 1) {
					p.x = j;
					p.y = i;
					goto END;
				}
			}
		}

END:
		for (int i = 0; i < 7; i++) {
			if (math[p.y + figure[i][0].y][p.x + figure[i][0].x] == 1 &&
				math[p.y + figure[i][1].y][p.x + figure[i][1].x] == 1 &&
				math[p.y + figure[i][2].y][p.x + figure[i][2].x] == 1 ) {
				cout << name[i] << endl;
				break;
			}
		}

		c = getchar();
		if (c == EOF)
			break;
	}
	return 0;
}

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;
	}
}