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 < 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)
	}
}

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++)
        {
            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;
}

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

/*
0123
456
78
9
*/
const int data[7][10] = {
						{1, 1, 0, 0, 1, 1, 0, 0, 0, 0},
						{1, 0, 0, 0, 1, 0, 0, 1, 0, 1},
						{1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
						{0, 1, 0, 0, 1, 1, 0, 1, 0, 0},
						{1, 1, 0, 0, 0, 1, 1, 0, 0, 0},
						{1, 0, 0, 0, 1, 1, 0, 0, 1, 0},
						{0, 1, 1, 0, 1, 1, 1, 0, 0, 0}
						};

const int change[10][2] = {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 3}, {1, 3}, {0, 4}};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	while(1){
		int c[15][15];
		for(int i = 0; i < 15; ++i){
			for(int j = 0; j < 15; ++j){
				c[j][i] = 0;
			}
		}

		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				char c0;
				cin >> c0;
				c[j][i] = (c0 == '0') ? 0 : 1;
			}
		}

		if(cin.eof()){
			break;
		}

		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				for(int k = 0; k < 7; ++k){
					bool check = true;
					for(int l = 0; l < 10; ++l){
						if(c[j + change[l][0]][i + change[l][1]] != data[k][l]){
							check = false;
							break;
						}
					}
					if(check){
						cout << char('A' + k) << endl;
						break;
					}
				}
			}
		}
	}

	return 0;
}

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

char whatFigure(int x, int y, char field[][9]) {
    int sum = 0;
    sum += field[y][x + 1] - '0';
    sum += (field[y + 1][x + 1] - '0') << 1;
    sum += (field[y + 1][x] - '0') << 2;
    if (x > 0) {
        sum += (field[y + 1][x - 1] - '0') << 3;
    }
    switch (sum) {
    case 7:
        return 'A';
        break;
    case 4:
        return 'B';
        break;
    case 1:
        return 'C';
        break;
    case 12:
        return 'D';
        break;
    case 3:
        return 'E';
        break;
    case 6:
        return 'F';
        break;
    case 13:
        return 'G';
        break;
    default:
        return '0';
        break;
    }
}

int main() {
    char field[8][9] = {};
start:
    while (cin >> field[0]) {
        for (int i = 1; i < 8; i++) {
            cin >> field[i];
        }
        for (int y = 0; y < 8; y++) {
            for (int x = 0; x < 8; x++) {
                if (field[y][x] == '1') {
                    cout << whatFigure(x, y, field) << endl;
                    goto start;
                }
            }
        }
    }
}

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

int main(){
	char p[7][18] = {"1100000011", "10000000100000001", "1111", "1000000110000001", "11000000011", "10000000110000000", "110000011"};
	char f[65];
	char t;
	while(1 + scanf("%c", &f[0])){
		for(int i = 1; i < 64; i++){
			scanf("%c", &t);
			if(t - 10){
				f[i] = t;
			}else{
				i--;
			}
		}
		f[64] = '\0';
		for(int i = 0; i < 7; i++){
			if(strstr(f, p[i])){
				printf("%c\n", i + 'A');
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int cnt=0;
string  w[12];
string ans;

	while(!cin.eof()){
		ans = "?";
		rep(i,8) rep(j,8) cin >> w[i][j];
		if(cin.eof()) break;
		rep(i,8) rep(j,8) if(w[i][j] == '1'){
			if(w[i][j+1]=='1' &&  w[i][j+2]=='1' && w[i][j+3]=='1'){
				ans = "C";  break; }
			if(w[i][j+1] =='1' && w[i+1][j+1]=='1' &&  w[i+1][j]=='1' ){
				ans = "A";  break; }
			if(w[i+1][j-1]=='1' && w[i+1][j]=='1' && w[i+2][j-1]=='1'){
				ans = "D";  break; }
			if(w[i][j+1]=='1' && w[i+1][j+1]=='1' && w[i+1][j+2]=='1'){
				ans = "E";  break; }
			if(w[i+1][j]=='1' && w[i+1][j+1]=='1' && w[i+2][j+1]=='1'){
				ans = "F";  break; }
			if(w[i][j+1]=='1' && w[i+1][j-1]=='1' && w[i+1][j]=='1' ){
				ans = "G";  break; }
			if(w[i+1][j]=='1' && w[i+2][j]=='1' && w[i+3][j]=='1' ){
				ans = "B";  break; }
			}
		cout <<  ans << endl;
//		cnt++; if(cnt>40) break;
	}
	return 0;
	
	
}