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>

using namespace std;

char p[8][9];

bool m(int i, int j) {
  return 0 <= i && i < 8 && 0 <= j && j < 8 && p[i][j] == '1';
}

int main() {
  while (cin >> p[0], !cin.eof()) {
    for (int i = 1; i < 8; i++)
      cin >> p[i];
    for (int i = 0; i < 8; i++)
      cout << p[i] << endl;
    for (int i = 0; i < 8; i++)
      for (int j = 0; j < 8; j++)
        if (p[i][j] == '1') {
          if (m(i, j+1) && m(i+1, j) && m(i+1, j+1))
            cout << 'A' << endl;
          else if (m(i+1, j) && m(i+2, j) && m(i+3, j))
            cout << 'B' << endl;
          else if (m(i, j+1) && m(i, j+2) && m(i, j+3))
            cout << 'C' << endl;
          else if (m(i+1, j) && m(i+1, j-1) && m(i+2, j-1))
            cout << 'D' << endl;
          else if (m(i, j+1) && m(i+1, j+1) && m(i+1, j+2))
            cout << 'E' << endl;
          else if (m(i+1, j) && m(i+1, j+1) && m(i+2, j+1))
            cout << 'F' << endl;
          else
            cout << 'G' << endl;
          goto epilogue;
        }
epilogue:;
  }
}

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

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


void clear(){
	for(int i=0; i<12; i++)
		for(int j=0; j<12; j++)
			n[i][j]='0';
}

int main(){
	clear();
	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\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;
					}

				}
			}
		}
		clear();
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<math.h>
#include<bitset>
using namespace std;
int main(){
	int a,b;
	char map[64];
	int movex[4]={1,0,-1,0},movey[4]={0,1,0,-1};
	while(cin>>map[0]){
		for(int i=1;i<64;i++){
			cin>>map[i];
		}
		int i,j;
		for(i=0;i<64;i++){
			if(map[i]=='1'){
				break;
			}
		}
		if(map[i+1]=='1'){
			if(map[i+8]=='1'&&map[i+9]=='1'){
				cout<<"A"<<endl;
			}
			else if(map[i+2]=='1'&&map[i+3]=='1'){
				cout<<"C"<<endl;
			}
			else if(map[i+9]=='1'&&map[i+10]=='1'){
				cout<<"E"<<endl;
			}
			else if(map[i+7]=='1'&&map[i+8]=='1'){
				cout<<"G"<<endl;
			}
		}
		else if(map[i+8]=='1'){
			if(map[i+16]=='1'&&map[i+24]=='1'){
				cout<<"B"<<endl;
			}
			else if(map[i+7]=='1'&&map[i+15]){
				cout<<"D"<<endl;
			}
			else if(map[i+9]=='1'&&map[i+17]=='1'){
				cout<<"F"<<endl;
			}
		}
		memset(map,'0',sizeof(map));
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

const int N = 8;
char m[N][N];

inline bool check(int x, int y){ return 0<=x&&x<N && 0<=y&&y<N; }

int main()
{
  while(true){
    rep(i, N) rep(j, N) if(!(cin >> m[i][j])) return 0;

    rep(i, N) rep(j, N) if(m[i][j] == '1'){
      if(check(i+1, j+1) && m[i+1][j]=='1' && m[i][j+1]  =='1' && m[i+1][j+1]=='1') cout << "A" << endl;
      if(check(i+3, j  ) && m[i+1][j]=='1' && m[i+2][j]  =='1' && m[i+3][j]  =='1') cout << "B" << endl;
      if(check(i  , j+3) && m[i][j+1]=='1' && m[i][j+2]  =='1' && m[i][j+3]  =='1') cout << "C" << endl;
      if(check(i+2, j-1) && m[i+1][j]=='1' && m[i+1][j-1]=='1' && m[i+2][j-1]=='1') cout << "D" << endl;
      if(check(i+1, j+2) && m[i][j+1]=='1' && m[i+1][j+1]=='1' && m[i+1][j+2]=='1') cout << "E" << endl;
      if(check(i+2, j+1) && m[i+1][j]=='1' && m[i+1][j+1]=='1' && m[i+2][j+1]=='1') cout << "F" << endl;
      if(check(i+1, j+1) &&
         check(i+1, j-1) && m[i][j+1]=='1' && m[i+1][j-1]=='1' && m[i+1][j]  =='1') cout << "G" << endl;
      break;
    }
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
char ma[8][8];

void c(int x,int y){

  if(ma[y+3][x] == '1'  )cout << 'B'<<endl;
  else if(ma[y][x+3] == '1')cout << 'C' << endl;
  else if(ma[y+2][x-1] == '1' )cout << 'D' << endl;
  else if(ma[y+1][x+2] == '1' )cout << 'E' << endl;
  else if(ma[y+2][x+2] == '1' )cout << 'F' << endl;
  else if(ma[y][x+1] == '1' && ma[y+1][x-1] == '1' )cout << 'G' << endl;
  else cout << 'A' <<endl;

}

int main(){



    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	cin >> ma[i][j]; 
      }
    }

    int f = 0;
    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(ma[i][j] == '1'){
	  c(j,i);
	  f = 1;
	}
	if(f)break;
      }
    if(f)break;    
  }
  return 0;
}