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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>

typedef long long ll;
using namespace std;

bool in(int i,int j){
	if(i >= 0 && i<8 && j>=0 && j<8) return true;
	return false;
}

bool is_A(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i+1,j) && table[i+1][j]==1
		&& in(i+1,j+1) && table[i+1][j+1]==1
		) return true;

	return false;
}

bool is_B(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i+1,j) && table[i+1][j]==1 
		&& in(i+2,j) && table[i+2][j]==1
		&& in(i+3,j) && table[i+3][j]==1
		) return true;

	return false;
}

bool is_C(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i,j+2) && table[i][j+2]==1
		&& in(i,j+3) && table[i][j+3]==1
		) return true;

	return false;
}

bool is_D(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i-1,j+1) && table[i-1][j+1]==1
		&& in(i+1,j) && table[i+1][j]==1
		) return true;

	return false;
}

bool is_E(int i,int j,int table[8][8])
{
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1 
		&& in(i+1,j+1) && table[i+1][j+1]==1
		&& in(i+1,j+2) && table[i+1][j+2]==1
		) return true;

	return false;
}

bool is_F(int i,int j,int table[8][8]){
	if(table[i][j]==1
		&& in(i+1,j) && table[i+1][j]==1 
		&& in(i+1,j+1) && table[i+1][j+1]==1
		&& in(i+2,j+1) && table[i+2][j+1]==1
		) return true;

	return false;
}

bool is_G(int i,int j,int table[8][8]){
	if(table[i][j]==1
		&& in(i,j+1) && table[i][j+1]==1
		&& in(i+1,j-1) && table[i+1][j-1]==1
		&& in(i+1,j) && table[i+1][j]==1 		
		) return true;

	return false;
}

int main()
{
	int table[8][8];
	

	while(1){
		bool is_eof = false;
		memset(table,0,sizeof(table));
		for(int i=0;i<8;i++){
			char buf[32];
			if(scanf("%s",buf)==EOF){
				is_eof = true;
				break;
			}
			for(int j=0;j<8;j++){
				table[i][j]=buf[j]-'0';
			}
		}
		
		if(is_eof) break;

		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(is_A(i,j,table)){
					cout << 'A' << endl;
					goto found;
				}
				else if(is_B(i,j,table)){
					cout << 'B' << endl;
					goto found;
				}
				else if(is_C(i,j,table)){
					cout << 'C' << endl;
					goto found;
				}
				else if(is_D(i,j,table)){
					cout << 'D' << endl;
					goto found;
				}
				else if(is_E(i,j,table)){
					cout << 'E' << endl;
					goto found;
				}
				else if(is_F(i,j,table)){
					cout << 'F' << endl;
					goto found;
				}
				else if(is_G(i,j,table)){
					cout << 'G' << endl;
					goto found;
				}
			}
		}
found:;
	}
}

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

#define SIZE 8

int main() {
	string source[SIZE];
	while (!cin.eof()) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		int map[14][14], x = SIZE, y = SIZE;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = source[i][j] == '1' ? 1 : 0;
				if (source[i][j] == '1' && j < x && i < y) {
					x = j;
					y = i;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] == 1) {
			if (map[y][x + 1] == 1 && map[y + 1][x] == 1) {
				cout << "A";
			} else if (map[y + 2][x + 1] == 1) {
				cout << "F";
			} else if (map[y + 1][x + 2] == 1) {
				cout << "E";
			}
		} else if (map[y - 1][x - 1] == 1) {
			if (map[y][x + 1] == 1) {
				cout << "G";
			} else if (map[y + 2][x - 1] == 1) {
				cout << "D";
			}
		} else if (map[y + 3][x]) {
			cout << "B";
		} else {
			cout << "C";
		}
		cout << 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;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
char ta[12][12];
int main(){
while(cin>>ta[0][0]){
	int y,x;
	bool f=1;
	for(int i=0;i<8;i++){
		for(int j=(i==0);j<8;j++){
			char now;
			cin>>now;
			if(now=='1'&&f){y=i,x=j;f=0;}
			ta[i][j]=now;
		}
	}
	if(ta[y][x+1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x+1]=='1')cout<<"A";
	
	else if(ta[y+1][x]=='1'&&ta[y+2][x]=='1'&&ta[y+3][x]=='1')cout<<"B";
	
	else if(ta[y][x+1]=='1'&&ta[y][x+2]=='1'&&ta[y][x+3]=='1')cout<<"C";
	
	else if(ta[y][x+1]=='1'&&ta[y+1][x+1]=='1'&&ta[y+1][x+2]=='1')cout<<"E";
	
	else if(ta[y+1][x]=='1'&&ta[y+1][x+1]=='1'&&ta[y+2][x+1]=='1')cout<<"F";
	
	else if(ta[y+2][x-1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x-1]=='1')cout<<"D";
	else cout<<"G";
	cout<<endl;
		for(int i=0;i<12;i++)for(int j=0;j<12;j++)ta[i][j]='0';
}
	
	return 0;
}