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 <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int dx[7][4]={{0,0,1,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,-1,0,1}};
int dy[7][4]={{0,1,1,0},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,1,1,0}};
string MAP[8];
string ans="ABCDEFG";

int main(){
	while(1){
	for(int i=0; i<8; ++i){
		if(!(cin >> MAP[i])){
			return 0;
		}
	}
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			if(MAP[i][j]=='1'){
				for(int k=0; k<7; ++k){
					bool ok=true;
					for(int l=0; l<4; ++l){
						int nx=j+dx[k][l];
						int ny=i+dy[k][l];
						if((0<=nx&&nx<8&&0<=ny&&ny<8&&MAP[ny][nx]!='1')||(nx<0||8<=nx||ny<0||8<=ny)){
							ok=false;
							break;
						}
					}
					if(ok){
						cout << ans[k] << "\n";
						break;
					}
				}
			}
		}
	}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	string s;
	while(cin >> s){
		bool a[10][10] = {0};
		for(int j = 1; j <= 8; j++){
			a[1][j] = s[j-1] - 48;
		}
		for(int i = 2; i <= 8; i++){
			cin >> s;
			for(int j = 1; j <= 8; j++){
				a[i][j] = s[j-1] - 48;
			}
		}
		bool f = true;
		for(int i = 1; i <= 8 && f; i++){
			for(int j = 1; j <= 8; j++){
				if(a[i][j]){
					if(a[i][j+1] && a[i+1][j] && a[i+1][j+1]) cout << "A" << endl;
					else if(a[i+1][j] && a[i+2][j] && a[i+3][j]) cout << "B" << endl;
					else if(a[i][j+1] && a[i][j+2] && a[i][j+3]) cout << "C" << endl;
					else if(a[i+1][j-1] && a[i+1][j] && a[i+2][j-1]) cout << "D" << endl;
					else if(a[i][j+1] && a[i+1][j+1] && a[i+1][j+2]) cout << "E" << endl;
					else if(a[i][j+1] && a[i+1][j-1] && a[i+1][j]) cout << "G" << endl;
					f = false;
					break;
				}
			}
		}
	}
	return 0;
}

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

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((i+k<0||i+k>7||j+l<0||j+k>7)&&A[n][k][l]==1){
	      fg=false;
	      break;
	    }
	  }
	  if(!fg)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++){
	if(scanf(" %c",&ch)==EOF)return 0;
	a[i][j]=ch-'0';
      }
    }
    check();
  }

  return 0;
}

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() {
	vcs m(MAX);
	for_(i, 0, MAX) cin >> m[i];
	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");
	
	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>
#include <string>
using namespace std;

int main()
{
    char field[11][11];
    string r;
    int i,j;
    do {
	for (i=0; i<8; i++)
	{
	    scanf("%s",field[i]);
	}
	for (i=0; i<8; i++)
	{
	    for (j=0; j<8; j++)
	    {
		if (field[i][j] == '1')goto b;
	    }
	}
    b:
	if (field[i][j+1] == '1')
	{
	    if (field[i][j+2] == '1')
		r="C";
	    else if (field[i+1][j] == '1')
		r="A";
	    else
		r="E";
	} else {
	    if (field[i+2][j] == '1')
		r="B";
	    else if (field[i+1][j+1] == '1')
		r="F";
	    else
		r="D";
	}
	cout << r << endl;
	getchar();
    } while (getchar() != EOF);
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
long i,n,n2,f;
string s;
while(cin>>n){
i=2;
while(n==0){cin>>n;i++;}
cin>>n2;
if(n2==0)f=2;
else if(n2==n){if(n%11==0)f=0;else f=1;}
else if(n2==n*11)f=3;
else if(n2==n/10)f=4;
else if(n2==n*10)f=6;
else f=5;
for(;i<8;i++)cin>>n;
cout<<"ABCDEFG"[f]<<endl;
}
return 0;
}