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<iostream>
using namespace std;
int dax[]={1,0,1};
int day[]={0,1,1};
int dbx[]={0,0,0};
int dby[]={1,2,3};
int dcx[]={1,2,3};
int dcy[]={0,0,0};
int ddx[]={0,-1,-1};
int ddy[]={1,1,2};
int dex[]={1,1,2};
int dey[]={0,1,1};
int dfx[]={0,1,1};
int dfy[]={1,1,2};
int dgx[]={1,0,-1};
int dgy[]={0,1,1};

int main()
{
	char f[10][10];

	while(cin>>f[0][0])
	{
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; j++)
			{
				if(i==0&&j==0) continue;
				cin>>f[i][j];
			}
		}
		/*cout<<"Complete!"<<endl;
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; j++)
			{
				cout<<f[i][j];
			}
			cout<<endl;
		}
*/
		bool flag=false;
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; ++j)
			{
				if(f[i][j]=='1')
				{
					for(int k = 0; k < 3; ++k)
					{
						if(j+dax[k]<0||j+dax[k]>7||i+day[k]<0||i+day[k]>7||f[i+day[k]][j+dax[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"A"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dbx[k]<0||j+dbx[k]>7||i+dby[k]<0||i+dby[k]>7||f[i+dby[k]][j+dbx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"B"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dcx[k]<0||j+dcx[k]>7||i+dcy[k]<0||i+dcy[k]>7||f[i+dcy[k]][j+dcx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"C"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+ddx[k]<0||j+ddx[k]>7||i+ddy[k]<0||i+ddy[k]>7||f[i+ddy[k]][j+ddx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"D"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dex[k]<0||j+dex[k]>7||i+dey[k]<0||i+dey[k]>7||f[i+dey[k]][j+dex[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"E"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dfx[k]<0||j+dfx[k]>7||i+dfy[k]<0||i+dfy[k]>7||f[i+dfy[k]][j+dfx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"F"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dgx[k]<0||j+dgx[k]>7||i+dgy[k]<0||i+dgy[k]>7||f[i+dgy[k]][j+dgx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"G"<<endl;
							break;
						}
					}
				}
			}
			if(flag) break;
		}
	}
  return 0;
}

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

vector <string> f;

const string P[7][4] = {
	{// A
		"1100",
		"1100",
		"0000",
		"0000"
	},
	{// B
		"1000",
		"1000",
		"1000",
		"1000"
	},
	{// C
		"1111",
		"0000",
		"0000",
		"0000"
	},
	{// D
		"0100",
		"1100",
		"1000",
		"0000"
	},
	{// E
		"1100",
		"0110",
		"0000",
		"0000"
	},
	{// F
		"1000",
		"1100",
		"0100",
		"0000"
	},
	{// G
		"0110",
		"1100",
		"0000",
		"0000"
	},
};

bool check( int x, int y, int k )
{
	for ( int i = 0; i < 4; i++ )
	{
		for ( int j = 0; j < 4; j++ )
		{
			int nx = x + j;
			int ny = y + i;
			if ( P[k][i][j] == '1' )
			{
				if ( nx < 0 || nx >= 8 || ny < 0 || ny >= 8 )
				{
					return false;
				}
				if ( P[k][i][j] != f[ny][nx] )
					return false;
			}
		}
	}
	return true;
}

int main( void )
{
	while ( cin.eof() == false )
	{
		f = vector <string>(8);
		string line;
		for ( int i = 0; i < 8; i++ )
		{
			getline( cin, line );
			f[i] = line;
			if ( cin.eof() ) break;
		}
		if ( cin.eof() ) break;
		getline( cin, line );

		char answer = 'A';
		bool not_found = true;
		for ( int i = 0; not_found && i < 8; i++ )
		{
			for ( int j = 0; not_found && j < 8; j++ )
			{
				for ( int k = 0; not_found && k < 7; k++ )
				{
					if ( check( j, i, k ) )
					{
						answer += k;
						not_found = false;
					}
				}
			}
		}

		cout << answer << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
char ma[8][8];
bool p(int i,int j){return (0<=i&&i<8&&0<=j&&j<8)&&(ma[i][j] == '1');}
void c(int x,int y){

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

}

int main(){
  int x,y;
  while(cin >> ma[0][0]){

    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(i + j == 0)continue;
	cin >> ma[i][j]; 
	if(ma[i][j] == '1'){x = j,y = i;}
      }
    }

    int f = 0;
    c(x,y);
  }
  return 0;
}

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

char sur[14][14];
const char WALL=10;

int main(void){
	char c;

	while(scanf("%c",&c)!=EOF){
		for(int y=0;y<14;y++){
			for(int x=0;x<14;x++){
				if(x<3 || x>10 || y<3 || y>10) sur[y][x]=WALL;
				else if(x==3 && y==3) sur[y][x]=c;
				else scanf(" %c",&(sur[y][x]));
			}
		}

		for(int y=0;y<14;y++){
			for(int x=0;x<14;x++){
				if(sur[y][x]=='1'){
					if(sur[y][x+1]=='1' && sur[y+1][x]=='1' && sur[y+1][x+1]=='1') cout<<"A\n";
					else if(sur[y+1][x]=='1' && sur[y+2][x]=='1' && sur[y+3][x]=='1') cout<<"B\n";
					else if(sur[y][x+1]=='1' && sur[y][x+2]=='1' && sur[y][x+3]=='1') cout <<"C\n";
					else if(sur[y+1][x]=='1' && sur[y+1][x-1]=='1' && sur[y+2][x-1]=='1') cout<<"D\n";
					else if(sur[y][x+1]=='1' && sur[y+1][x+1]=='1' && sur[y+1][x+2]=='1') cout<<"E\n";
					else if(sur[y+1][x]=='1' && sur[y+1][x+1]=='1' && sur[y+2][x+1]=='1') cout<<"F\n";
					else if(sur[y][x+1]=='1' && sur[y+1][x]=='1' && sur[y+1][x-1]=='1') cout<<"G\n";
					break;
				}
			}
		}
	}

	return 0;
}