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(), "")
		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 <vector>
#include <stdio.h>
using namespace std;
int main() {
  char c[11][11];
  vector<int> v;
  int dat[7][6]={{1,1,1,1,0,0},{1,0,1,0,1,0},{1,1,0,0,0,0},{1,0,1,0,0,0},{1,1,0,1,0,0},
  {1,0,1,1,0,1},{1,1,1,0,0,0}};
  int i,j,k,x,y,f;
  while(true) {
      f=0;
	  for (i=0;i<8;i++) {
		  if (gets(c[i])==NULL) { i=10; break;}
		  if (f==0) for (j=0;j<8;j++) if (c[i][j]=='1') { f=1; x=j; y=i; j=9;}
	  }
	  if (i==10) break;
	  cout << endl;
	  for (k=0;k<7;k++) {
		  f=0;
		  for (i=0;i<3;i++) for (j=0;j<2;j++) {
			  if (x+j>7 || y+i>7) { if (dat[k][j+i*2]==0) f++;}  else
				  if (c[y+i][x+j]==('0'+dat[k][j+i*2])) f++;
		  }
		  if (f==6) break;
	  }
	  v.push_back(k);
  }
  for (i=0;i<v.size();i++) cout << (char)('A'+v[i]) << endl;
  return 0;
}

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

int main(){
	char n[12][12];
	char figure[7][4][5] = {
		{"1100","1100","0000","0000"},
		{"1000","1000","1000","1000"},
		{"1111","0000","0000","0000"},
		{"0100","1100","1000","0000"},
		{"1100","0110","0000","0000"},
		{"1000","1100","0100","0000"},
		{"0110","1100","0000","0000"}
	};

	for(int i=0; i<12; i++)
		for(int j=0; j<12; j++)
			n[i][j]='0';
	
	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n\n", n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])){

		for(int i=0; i<7; i++){
			for(int j=0; j<8; j++){
				for(int k=0; k<8; k++){
					bool flag=true;
					
					for(int x=0; x<4; x++){
						for(int y=0; y<4; y++){
							if(figure[i][x][y] != n[j+x][k+y]) flag = false;
						}
					}
					
					if(flag){
						cout << (char)('A'+i) << endl;
					}

				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>

#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

int main() {
	char a, c;
	int map[10][10];

	while(cin >> c) {
		if(c == '0' || c== '1') {
			rep(i,10)rep(j,10)
				map[i][j] = 0;

			rep(i,8)rep(j,8) {
				if(!(i + j == 0)) ifs >> c;
				map[i][j] = (int)(c - '0');
			}

			rep(i,8)rep(j,8) {
				if(map[i][j]) {
					if(map[i][j+2])   a = 'C';
					if(map[i+2][j])   a = 'B';
					if(map[i+1][j+1]) a = 'A';
					if(map[i+1][j-1]) a = 'G';
					if(map[i+1][j+2]) a = 'E';
					if(map[i+2][j+1]) a = 'F';
					if(map[i+2][j-1]) a = 'D';
					break;
				}
			}

			cout << a << endl;
		}
	}

	return 0;
}

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

int main(){
	string surface[8];
	while(cin >> surface[0]){
		for(int i = 1; i < 8; i++)cin >> surface[i];
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(surface[i][j] == '1'){
					if(surface[i][j + 1] == '1'){
						if(surface[i][j + 2] == '1'){
							cout << "C" << endl;
							goto fin;
						}else{
							if(surface[i + 1][j] == '1'){
								if(surface[i + 1][j + 1] == '1'){
									cout << "A" << endl;
									goto fin;
								}else{
									cout << "G" << endl;
									goto fin;
								}
							}else{
								cout << "E" << endl;
								goto fin;
							}
						}
					}else{
						if(surface[i + 2][j] == '1'){
							cout << "B" << endl;
							goto fin;
						}else{
							if(surface[i + 1][j + 1] == '1'){
								cout << "F" << endl;
								goto fin;
							}else{
								cout << "D" << endl;
								goto fin;
							}
						}
					}
				}
			}
		}
		fin:;
	}
}

C++: #include<iostream>
#include<string>

using namespace std;
int main(){
	
	while(1){
	string str[8];
	for(int i =0;i<8;i++)
		cin >> str[i];
	
	bool stop = false;
	for(int i=0;i<8;i++){
	for(int k=0;k<8;k++){
	if(str[i][k] == '1'){
		if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k] == '1' ){
		cout << "A" << endl;  stop = true; break;
		} else if(str[i+1][k] == '1' && str[i+2][k] == '1'&& str[i+3][k] == '1' ){
		cout << "B" << endl; stop = true; break;
		} else if(str[i][k+1] == '1' && str[i][k+2] == '1'&& str[i][k+3] == '1' ){
		cout << "C" << endl;  stop = true; break;
		} else if(str[i+1][k] == '1' && str[i+1][k-1] == '1'&& str[i+2][k-1] == '1' ){
		cout << "D" << endl;  stop = true; break;
		} else if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k+2] == '1' ){
		cout << "E" << endl;  stop = true; break;
		} else if(str[i+1][k] == '1' && str[i+1][k+1] == '1'&& str[i+2][k+1] == '1' ){
		cout << "F" << endl;  stop = true; break;
		} else if(str[i][k+1] == '1' && str[i+1][k] == '1'&& str[i+1][k-1] == '1' ){
		cout << "G" << endl;  stop = true; break;
		}
	
	}
	
	}
	if(stop == true) break;
	}
	if(cin.eof()) return 0;
	
	}
	
}

C++: #include <stdio.h>

int main(void) {
  char s[8][10];
  int i, j, k, l;
  int dx[7][3] = {
    {1, 1, 0},
    {0, 0, 0},
    {1, 2, 3},
    {0, -1, -1},
    {1, 1, 2},
    {0, 1, 1},
    {1, -1, 0}
  }, dy[7][3] = {
    {0, 1, 1},
    {1, 2, 3},
    {0, 0, 0},
    {1, 1, 2},
    {0, 1, 1},
    {1, 1, 2},
    {0, 1, 1}
  };
  while(scanf("%s", s[0]) != EOF) {
    for(i = 1; i < 8; ++i) scanf("%s", s[i]);
    int t = 1;
    for(i = 0; i < 8; ++i) {
      for(j = 0; j < 8; ++j) {
        if(s[i][j] == '1') {
          for(k = 0; k < 7; ++k) {
            for(l = 0; l < 3; ++l) {
              if(i + dy[k][l] < 0 || i + dy[k][l] > 8 || j + dx[k][l] < 0 || j + dx[k][l] > 8 || s[i + dy[k][l]][j + dx[k][l]] == '0') break;
            }
            if(l == 3) {
              printf("%c\n", 'A' + k);
              break;
            }
          }
          t = 0;
          break;
        }
      }
      if(!t) break;
    }
  }
  return 0;
}