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>
#include <string>
#include <array>
#include <utility>
#include <algorithm>

using namespace std;

int main()
{
    array<pair<int, int> const, 4> const p[7] ={
        {{{0,0}, {1,0}, {0,1}, {1,1}}},
        {{{0,0}, {0,1}, {0,2}, {0,3}}},
        {{{0,0}, {1,0}, {2,0}, {3,0}}},
        {{{0,0}, {-1,1}, {0,1}, {-1,2}}},
        {{{0,0}, {1,0}, {1,1}, {2,1}}},
        {{{0,0}, {0,1}, {1,1}, {1,2}}},
        {{{0,0}, {1,0}, {-1,1}, {1,1}}},
    };

    string e;
    do {
        bool b[20][20] = {};
        int fx = 20, fy = 20;
        for( int y=0; y<8; ++y ) {
            for( int x=0; x<8; ++x ) {
                char c;
                cin >> c;
                b[4+x][4+y] = c == '1';
                if ( b[4+x][4+y] ) {
                    fx = min( fx, 4+x );
                    fy = min( fy, 4+y );
                }
            }
        }

        for( int i=0; i<7; ++i ) {
            if ( b[fx+p[i][0].first][fy+p[i][0].second]
                 && b[fx+p[i][1].first][fy+p[i][1].second]
                 && b[fx+p[i][2].first][fy+p[i][2].second]
                 && b[fx+p[i][3].first][fy+p[i][3].second]
                ) {
                cout << static_cast<char>( 'A' + i ) << endl;
                break;
            }
        }

    } while( getline( cin, e ) );
}

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

using namespace std;

char table[12][12]={0};

int main(void){
	int sx,sy;
	while(true){
		for(int y=1;y<=8;y++)
			for(int x=1;x<=8;x++)
				cin >> table[x][y],table[x][y]-='0';
		if(cin.eof())
			break;
		for(int y=1;y<=8;y++)
			for(int x=1;x<=8;x++)
				if(table[x][y])
					sx=x,sy=y,x=9,y=9;
		if(table[sx][sy]&table[sx+1][sy]&table[sx][sy+1]&table[sx+1][sy+1])
			cout << 'A' << endl;
		else if(table[sx][sy]&table[sx][sy+1]&table[sx][sy+2]&table[sx][sy+3])
			cout << 'B' << endl;
		else if(table[sx][sy]&table[sx+1][sy]&table[sx+2][sy]&table[sx+3][sy])
			cout << 'C' << endl;
		else if(table[sx][sy]&table[sx-1][sy+1]&table[sx][sy+1]&table[sx-1][sy+2])
			cout << 'D' << endl;
		else if(table[sx][sy]&table[sx+1][sy]&table[sx+1][sy+1]&table[sx+2][sy+1])
			cout << 'E' << endl;
		else if(table[sx][sy]&table[sx][sy+1]&table[sx+1][sy+1]&table[sx+1][sy+2])
			cout << 'F' << endl;
		else if(table[sx][sy]&table[sx+1][sy]&table[sx-1][sy+1]&table[sx][sy+1])
			cout << 'G' << endl;
	}
}

C++: #include<iostream>
#include<vector>
#include<array>
#include<string>
#include<sstream>
#define _X_ 0
#define _Y_ 1
int main()
{
	while (true)
	{
		std::vector<std::array<int, 2>>p;
		p.reserve(4);
		for (int i = 0; i < 8; i++)
		{
			std::string temp;
			std::cin >> temp;
			std::stringstream st(temp);
			for (int j = 0; j < 8; j++)
			{
				char foo;
				st >> foo;
				if (foo == '1')
				{
					p.push_back({ j, i });
				}
			}
		}
		if (std::cin.eof())
		{
			break;
		}
		if (p[0][_Y_] == p[1][_Y_])
		{
			if (p[0][_X_] == p[2][_X_])
			{
				std::cout << 'A' << std::endl;
			}
			else if (p[0][_Y_] == p[2][_Y_])
			{
				std::cout << 'C' << std::endl;
			}
			else if (p[1][_X_] == p[2][_X_])
			{
				std::cout << 'E' << std::endl;
			}
			else if (p[0][_X_] == p[3][_X_])
			{
				std::cout << 'G' << std::endl;
			}
		}
		else
		{
			if (p[0][_X_] == p[3][_X_])
			{
				std::cout << 'B' << std::endl;
			}
			else if (p[0][_X_] > p[3][_X_])
			{
				std::cout << 'D' << std::endl;
			}
			else
			{
				std::cout << 'F' << std::endl;
			}
		}
	}
	return 0;
}

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

#define rep(i,n) for(int i = 0 ; i < n ;i++ )
using namespace std;

int main(){
 char  ma[8][8];
  while(!cin.eof()){
    rep(i,8){
      rep(j,8){
ma[i][j]='0';
      }
    }
    rep(i,8){
      rep(j,8){
	cin >> ma[i][j];

      }
    }
    rep(i,8){
      rep(j,8){
	if(ma[i][j]=='1'){
	  if(ma[i][j+1] == '1' && ma[i+1][j+1] == '1'&& i+1 < 8&&j+1 < 8 ){
	    cout << 'A' << endl;
	    goto f;
	  }else if(ma[i+3][j] == '1' &&i+3 < 8){
	    cout << 'B' << endl;
	    goto f;
	  }else if(ma[i][j+3] == '1'&& j+3 < 8){
	    cout << 'C' << endl;
	    goto f;
	  }else if(ma[i+3][j-1] == '1' && i+3 < 8 && 0 < j-1){
	    cout << 'D' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1<8 && j+3 < 8){
	    cout << 'E' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1 < 8&& j+3 < 8){
	    cout << 'F' << endl;
	    goto f;
	  }else if(ma[i][j+1] == '1' && ma[i+1][j-1] == '1' && j+1 < 8 && i+1 < 8 && 0<j-1 ){
	    cout << 'G' << endl;
	    goto f;
	  }
	}
      }
    }
  f:
  }
  
  return 0;
}

C++: #include<stdio.h>
int main(){
	int field[8][8];
	int a,b;
	for(;;){
		for(b=0;b<8;b++){
			for(a=0;a<8;a++){if(scanf("%1d",&field[a][b]) == EOF){break;}}
			if(a!=8){break;}
		}
		if(b!=8){break;}
		for(b=0;b<8;b++){
			for(a=0;a<8;a++){
				if(field[a][b] == 1){
					if(field[a][b] == 1 && field[a+1][b] == 1 && field[a][b+1] == 1 && field[a+1][b+1] == 1){printf("A\n");break;}
					else if(field[a][b] == 1 && field[a][b+1] == 1 && field[a][b+2] == 1 && field[a][b+3] == 1){printf("B\n");break;}
					else if(field[a][b] == 1 && field[a+1][b] == 1 && field[a+2][b] == 1 && field[a+3][b] == 1){printf("C\n");break;}
					else if(field[a][b] == 1 && field[a][b+1] == 1 && field[a-1][b+1] == 1 && field[a-1][b+2] == 1){printf("D\n");break;}
					else if(field[a][b] == 1 && field[a+1][b] == 1 && field[a+1][b+1] == 1 && field[a+2][b+1] == 1){printf("E\n");break;}
					else if(field[a][b] == 1 && field[a][b+1] == 1 && field[a+1][b+1] == 1 && field[a+1][b+2] == 1){printf("F\n");break;}
					else if(field[a][b] == 1 && field[a+1][b] == 1 && field[a][b+1] == 1 && field[a-1][b+1] == 1){printf("G\n");break;}
				}
			}
			if(a!=8){break;}
		}
	}
	return 0;
}