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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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<string>
#include<stdio.h>
using namespace std;
char data[8][8];


struct P{
	P(){};
	P(int a,int b){
		x=a;
		y=b;
	}
	int x,y;
};

bool input(){
	for(int i=0;i<8;i++){
		if( scanf( "%s",data[i] ) == EOF )return false;
	}
	return true;
}
int main(){
	
	while(input()){
		P o;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(data[i][j]=='1'){
					o=P(j,i);
					goto suc;
				}
			}
		}
		suc:;
		{
			for(int i=0;i<2;i++){
				for(int j=0;j<2;j++){
					if(o.y+i>=8 || o.x+j>=8)goto fail1;
					if(data[o.y+i][o.x+j]!='1')goto fail1;
				}
			}
			cout<<"A"<<endl;
			continue;
			fail1:;
		}
		{
			for(int i=0;i<4;i++){
				if(o.y+i>=8)goto fail2;
				if(data[o.y+i][o.x]!='1')goto fail2;
			}
			cout<<"B"<<endl;
			continue;
			fail2:; 
		}
		{
			for(int i=0;i<4;i++){
				if(o.x+i>=8)goto fail3;
				if(data[o.y][o.x+i]!='1')goto fail3;
			}
			cout<<"C"<<endl;
			continue;
			fail3:;
		}
		{
			if(o.y+2>=8 || o.x-1<=0)goto fail4;
			if(data[o.y+1][o.x]!='1')goto fail4;
			if(data[o.y+1][o.x-1]!='1')goto fail4;
			if(data[o.y+2][o.x-1]!='1')goto fail4;
			cout<<"D"<<endl;
			continue;
			fail4:;
		}
		{
			if(o.x+2>=8 || o.y+1>=8)goto fail5;
			if(data[o.y][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+2]!='1')goto fail5;
			cout<<"E"<<endl;
			continue;
			fail5:;
		}
		{
			if(o.x+1>=8 || o.y+2>=8)goto fail6;
			if(data[o.y+1][o.x]!='1')goto fail6;
			if(data[o.y+1][o.x+1]!='1')goto fail6;
			if(data[o.y+2][o.x+1]!='1')goto fail6;
			cout<<"F"<<endl;
			continue;
			fail6:;
		}
		{
			cout<<"G"<<endl;
		}
	}
}

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

void solve(vector<vector<char> > a){
	for(int i = 0; i < 6; i++){
		for(int j = 0; j < 6; j++){
			if(a[i][j] == '1' && a[i + 1][j] == '1' && a[i][j + 1] == '1' && a[i + 1][j + 1] == '1'){
				cout << "A" << endl;
				return;
			}else if(a[i][j] == '1' && a[i + 1][j] == '1' && a[i + 2][j] == '1'){
				cout << "B" << endl;
				return;
			}else if(j > 0 && i > 0){
				if(a[i][j] == '1' && a[i - 1][j - 1] == '1' && a[i + 1][j] == '1' && a[i + 2][j + 1] == '1'){
					cout << "D" << endl;
					return;
				}else if(a[i][j] == '1' && a[i][j - 1] == '1' && a[i + 1][j] == '1' && a[i + 1][j + 1] == '1'){
					cout << "E" << endl;
					return;
				}else if(a[i][j] == '1' && a[i + 1][j] == '1' && a[i + 1][j + 1] == '1' && a[i + 2][j + 1] == '1'){
					cout << "F" << endl;
					return;
				}else if(a[i][j] == '1' && a[i][j + 1] == '1' && a[i + 1][j - 1] == '1' && a[i + 1][j] == '1'){
					cout << "G" << endl;
					return;
				}
			}
		}
	}
	cout << "C" << endl;
}

int main(){
	vector<vector<char> > a(8, vector<char>(8));
	while(cin >> a[0][0]){
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(i != 0 || j != 0)cin >> a[i][j];
			}
		}
		solve(a);
	}
}

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

using namespace std;

char s[15][15];

char Solution(int i, int j)
{
    if(s[i][j]=='1' && s[i + 1][j] == '1' && s[i][j + 1] == '1' && s[i + 1][j + 1] == '1')
    {
        return 'A';
    }
    
    if(s[i][j] == '1' && s[i + 1][j] == '1' && s[i + 2][j] == '1' && s[i + 3][j] == '1')
    {
        return 'B';
    }
    
    if(s[i][j] == '1' && s[i][j + 1] == '1' && s[i][j + 2] == '1' && s[i][j + 3] == '1')
    {
        return 'C';
    }
    
    if(s[i][j] == '1' && s[i][j + 1] == '1' && s[i + 1][j + 1] == '1' && s[i + 1][j + 2] == '1')
    {
        return 'E';
    }
    
    if(s[i][j] == '1' && s[i + 1][j] == '1' && s[i + 1][j + 1] == '1'&&s[i + 2][j + 1] == '1')
    {
        return 'F';
    }
    
    if(j > 0)  // can not start from j = 0
    {
        if(s[i][j] == '1' && s[i + 1][j] == '1' && s[i + 1][j - 1] == '1' && s[i + 2][j - 1] == '1')
        {
            return 'D';
        }
        
        if(s[i][j] == '1' && s[i + 1][j] == '1' && s[i + 1][j - 1] == '1' && s[i][j + 1] == '1')
        {
            return 'G';
        }
    }
    
    return 0;
}

int main()
{
    while(!cin.eof())  // tests for end-of-file
    {
        
        for(int i = 0; i < 15; i++)
        {
            for(int j = 0; j < 15; j++)
            {
                s[i][j] = '0';
            }
        }
        
        for(int i = 0; i < 8; i++)
        {
            for (int j = 0 ; j < 8; j++)
            {
                cin>>s[i];
            }

        }
        
        char figure;
        
        bool solved = true;
        
        for(int i=0;i<8;i++)
        {
            for(int j=0;j<8;j++)
            {
                if(s[i][j]!='1')
                {
                    continue;
                }
                
                if(solved)
                {
                    figure = Solution(i, j);
                    
                    cout<<figure<<endl;
                    
                    solved = false;
                }
            }
        }
    }
    return 0;
}