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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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;
/*
A 11 B 1 C 1111 D 01 E 110 F 10 G 011
  11   1          11   011   11   110
       1          10         01
       1
*/
int main() {
    string map[8], in;
    while (cin>>in) {
        map[0]=in;
        int h;
        string key[4];
        if (in=="00000000") h=0;
        else {
            key[0]=in;
            h=1;
        }
        for (int i=1; i<8; i++) {
            cin>>map[i];
            if (map[i]!="00000000") key[h++]=map[i];
        }
        if (h==4) cout<<"B"<<endl;
        else if (h==1) cout<<"C"<<endl;
        else if (h==3) {
            bool flag=true;
            for (int i=0; i<8; i++) if (key[1][i]=='1') {
                if (key[0][i]=='1') flag=false;
                break;
            }
            if (flag) cout<<"D"<<endl;
            else cout<<"F"<<endl;
        } else {
            bool flag=true;
            for (int i=0; i<8; i++) if (key[0][i]=='1') {
                if (key[1][i]=='0') flag=false;
                break;
            }
            if (flag) {
                for (int i=0; i<8; i++) if (key[1][i]=='1') {
                    if (key[0][i]=='0') flag=false;
                    break;
                }
                if (flag) cout<<"A"<<endl;
                else cout<<"G"<<endl;
            } else {
                cout<<"E"<<endl;
            }
        }
    }
}

C++: #include <iostream>
using namespace std;
typedef unsigned long long ull;
int main() {
  ull map, shape[] = {0x303, 0x1010101, 0xf, 0x10302, 0x603, 0x20301, 0x306};
  char c, ans;
  int i, j;
  while (cin >> c) {
    map = c - '0';
    for (i = 1; i < 64; i++) {
      cin >> c;
      if (c == '1') map |= (ull) 1 << i;
    }
    for (i = 0; i < 64; i++)
      for (j = 0; j < 7; j++)
        if (((map >> i) & shape[j]) == shape[j]) {
          ans = j + 'A';
          goto p;
        }
    p:
    cout << ans << endl;
  }
}

C++: #include <iostream>

using namespace std;
int main()
{
  string a[8];
  for(;cin>>a[0];)
    {
      for(int i=1;i<8;i++)
	cin>>a[i];
      char n='X';
      for(int i=0;i<8;i++)
	for(int j=0;j<8;j++)
	  if(a[i][j]=='1')
	    {
	      if(i<7&&j<7&&a[i][j+1]=='1' &&a[i+1][j]=='1' &&a[i+1][j+1]=='1')
		n='A';
	      else if(i<5&&a[i+1][j]=='1' &&a[i+2][j]=='1' &&a[i+3][j]=='1')
		n='B';
	      else if(j<5&&a[i][j+1]=='1' &&a[i][j+2]=='1' &&a[i][j+3]=='1')
		n='C';
	      else if(i>0&&j<6&&a[i][j+1]=='1' &&a[i-1][j+1]=='1' &&a[i-1][j+2]=='1')
		n='D';
	      else if(i<7&&j<6&&a[i][j+1]=='1' &&a[i+1][j+1]=='1' &&a[i+1][j+2]=='1')
		n='E';
	      else if(i<6&&j<7&&a[i+1][j]=='1' &&a[i+1][j+1]=='1' &&a[i+2][j+1]=='1')
		n='F';
	      
	      if(n!='X')
		break;
	    }
      if(n=='X')
	n='G';
      cout<<n<<endl;

    }
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



int MAX = 8;

int main() {
	vector< vcs > b(7);
	b[0].pb("11"); b[0].pb("11");
	b[1].pb("1"); b[1].pb("1"); b[1].pb("1"); b[1].pb("1");
	b[2].pb("1111");
	b[3].pb("01"); b[3].pb("11"); b[3].pb("10");
	b[4].pb("110"); b[4].pb("011");
	b[5].pb("10"); b[5].pb("11"); b[5].pb("01");
	b[6].pb("011"); b[6].pb("110");
	
	vcs m(MAX);
	string tes;
	
	while (cin >> tes) {
		if (tes=="") continue;
		
		m[0] = tes;
		for_(i, 1, MAX) cin >> m[i];
	
		for_(k, 0, 7) {
			vcs bl = b[k];
			int Y = (int)bl[0].sz, X = (int)bl.sz;
		
			bool flag = false;
			for_(i, 0, MAX-X+1) for_(j, 0, MAX-Y+1){
				bool f = true;
				for_(x, 0, X) for_(y, 0, Y) {
					if (m[i+x][j+y] != bl[x][y]) f = false;				
				}
				if (f) flag = true;
			}
		
			if (flag) {
				char ans = 'A' + k;
				cout << ans << endl;
				break;
			}
		}
	}
	
	return 0;
}

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

int G[8][8];

bool in_range(int a,int b){
  return 0<= a && a < 8 && 0 <= b && b < 8;
}

void check(int x,int y)
{
  char res = 'A';
  if(in_range(y - 3,x)&&G[x][y - 3])res = 'B';
  else if(in_range(y,x - 3)&&G[x - 3][y])res = 'C';
  else if(in_range(y - 2,x+1 )&&G[x + 1][y  - 2])res = 'D';
  else if(in_range(y - 1,x-2 )&&G[x - 2][y  - 1])res = 'E';
  else if(in_range(y - 2,x-1 )&&G[x - 1][y  - 2])res = 'F';
  else if(in_range(y - 1,x+1 )&&G[x + 1 ][y  - 1])res = 'G';
  cout << res << endl;
}

int main(){
  int sx,sy;
  char c;
  for(int i = 0 ; i < 8 ; i++ ){
    for(int j = 0 ; j < 8 ; j++ ){
      cin >> c;
      G[j][i] = c - '0';
    if(G[j][i] == 1){
      sx = j;
      sy = i;
    }
    }
  }
  check(sx,sy);
}