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)
		fmt.Scanln()
	}
}

C++: #include<cstdio>

class pair{
  public:
  bool b;
  int i;
  int j;
  void init(int i){
    b = i ? true : false;
    i = j = 0;
  }
};

using namespace std;
int main(){
  int s[8][8];
  pair x;
  while(scanf("%1d",&s[0][0])!=EOF){
    x.init(s[0][0]);
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
        if(i==0&&j==0)j++;
        scanf("%1d",&s[i][j]);
        if(!x.b&&s[i][j]){
          x.i=i;
          x.j=j;
          x.b=true;
        }
      }
    }
    
    for(int i=0;i<8;i++){for(int j=0;j<8;j++)printf("%d",s[i][j]);printf("\n");}
    printf("%d %d\n",x.i,x.j);

    if(x.j!=7){
      if(s[x.i][x.j+1]){
        if(x.i!=7){
          if(s[x.i+1][x.j]){
            if(s[x.i+1][x.j+1])printf("A\n");
            else printf("G\n");
          }
          else if(s[x.i+1][x.j+1])printf("E\n");
          else printf("C\n");
          }
        else printf("C\n");
      }
      else if(s[x.i+1][x.j+1])printf("F\n");
      else if(x.j!=0){
        if(s[x.i+1][x.j-1])printf("D\n");
        else printf("B\n");
      }
      else printf("B\n");
    }
    else if(x.j!=0){
      if(s[x.i+1][x.j-1])printf("D\n");
      else printf("B\n");
    }
    else printf("B\n");
  }
  return 0;
}

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

typedef pair<int, int> p;
p shapes[7][3] = 
{
	{ p(1, 0), p(0, 1), p(1, 1)		},
	{ p(0, 1), p(0, 2), p(0, 3)		},
	{ p(1, 0), p(2, 0), p(3, 0)		},
	{ p(0, 1), p(-1, 1), p(-1, 2)	},
	{ p(1, 0), p(1, 1), p(2, 1)		},
	{ p(0, 1), p(1, 1), p(1, 2)		},
	{ p(1, 0), p(0, 1), p(-1, 1)	}
};
string table[8];

int main()
{
	while (true)
	{
		for (int i = 0; i < 8; i++)
		{
			if (!(cin >> table[i])) return 0;
		}

		p upperLeft;
		for (int y = 0; y < 8; y++)
		{
			for (int x = 0; x < 8; x++)
			{
				if (table[y][x] == '1')
				{
					upperLeft = p(x, y);
					goto Break;
				}
			}
		}
		Break:

		for (int i = 0; i < 7; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				int X = upperLeft.first + shapes[i][j].first;
				int Y = upperLeft.second + shapes[i][j].second;
				if (!(0 <= X && X < 8 && 0 <= Y && Y < 8)) break;
				if (table[Y][X] == '0') break;
				if (j == 2) cout << char('A' + i) << endl;
			}
		}
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int i,j;
	char map[10][10];
	
	for(;cin >> map[0][0];)
	{
		int sx,sy,flag=0;;
		
		for(i=0;i<8;i++)
		{
			for(j=0;j<8;j++)
			{
				if(i==0 && j==0)
					j++;
				cin >> map[i][j];
				
				
				if(map[i][j]=='1' && flag==0)
				{
					sy=i;
					sx=j;
					flag=1;
				}
			}
		}
		
		if(map[sy][sx+1]=='1' && sx+1<8)
		{
			if(map[sy+1][sx]=='1' && sy+1<8)
			{
				if(map[sy+1][sx+1]=='1')
					cout << "A" << endl;
				else
					cout << "G" << endl;
			}
			else
			{
				if(map[sy][sx+2]=='1' && sx+2<8)
					cout << "C" << endl;
				else
					cout << "E" << endl;
			}
		}
		else
		{
			if(map[sy+2][sx]=='1' && sy+2<8)
				cout << "B" << endl;
			else
			{
				if(map[sy+1][sx+1]=='1' && sx+1<8)
					cout << "F" << endl;
				else
					cout << "D" << endl;
			}
		}
	}
}

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

struct ca {
	int x;
	int y;
};

int main() {
	ca l[4];
	int a = 0;
	for (int i = 0; i < 8; i++){
		for (int j = 0; j < 8; j++){
			char c;
			cin >> c;
			if (c == '1')
			{
				l[a].x = i;
				l[a].y = j;
				a++;
			}
		}
	}
	int x = l[0].x;
	int y = l[0].y;
	if (l[1].x == x&&l[1].y == y + 1){
		//[l0][l1]
		//ACEG
		if (l[3].x == x + 1 && l[3].y == y + 1)
			cout << 'A';
		else if (l[3].y == y + 3)
			cout << 'C';
		else if (l[3].x == x + 1 && l[3].y == y + 2)
			cout << 'E';
		else cout << 'G';
	}
	else if (l[1].x == x + 1 && l[1].y == y){
		/*[l0]
		  [l1]*/
		//BF
		if (l[3].x == x + 3 && l[3].y == y) 
			cout << 'B';
		else cout << 'F';
	}
	else cout << 'D';
	cout << endl;
	char c;
	cin >> c;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
long i,n,n2,f;
while(cin>>n){
i=2;
while(n==0){cin>>n;i++;}
if(i==8)f=2;
else{
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;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
char ta[10][10];
int main(){
	while(cin>>ta[1][1]){
		for(int i=1;i<=8;i++)for(int j=(i==1)+1;j<=8;j++)cin>>ta[i][j];
	
		for(int i=1;i<=8;i++){
			for(int j=1;j<=8;j++){
				char ans='?';
				if(ta[i][j]=='1'){
				if(ta[i+1][j]=='1'&&ta[i][j+1]=='1'&&ta[i+1][j+1]=='1')ans='A';
				
				else if(ta[i+1][j]=='1'&&ta[i+1][j]=='1'&&ta[i+3][j]=='1')ans='B';
				
				else if(ta[i][j+1]=='1'&&ta[i][j+2]=='1'&&ta[i][j+3]=='1')ans='C';
				
				else if(ta[i+1][j]=='1'&&ta[i+1][j-1]=='1'&&ta[i+2][j-1]=='1')ans='D';
				
				else if(ta[i][j+1]=='1'&&ta[i+1][j+1]=='1'&&ta[i+1][j+2]=='1')ans='E';
				
				else if(ta[i+1][j]=='1'&&ta[i+1][j+1]=='1'&&ta[i+2][j+1]=='1')ans='F';
				
				else if(ta[i][j+1]=='1'&&ta[i+1][j]=='1'&&ta[i+1][j-1]=='1')ans='G';
				}
				if(ans!='?'){cout<<ans<<endl;goto next;}
			}
		}
	
	next:;
	}
	return 0;
}