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

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

string grid[8];
bool is_A(int i,int j) {
    if(i+1>=8 || j+1>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i][j+1]=='0') return false;
    if(grid[i+1][j+1]=='0') return false;
    return true;

}
bool is_B(int i,int j) {
    if(i+3>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i+2][j]=='0') return false;
    if(grid[i+3][j]=='0') return false;
    return true;
}
bool is_C(int i,int j) {
    if(j+3>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i][j+1]=='0') return false;
    if(grid[i][j+2]=='0') return false;
    if(grid[i][j+3]=='0') return false;
    return true;
}
bool is_D(int i,int j) {
    if(i+2>=8||j-1<0) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i+1][j-1]=='0') return false;
    if(grid[i+2][j-1]=='0') return false;
    return true;
}
bool is_E(int i,int j) {
    if(i+1>=8||j+2>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i][j+1]=='0') return false;
    if(grid[i+1][j+1]=='0') return false;
    if(grid[i+1][j+2]=='0') return false;
    return true;
}
bool is_F(int i,int j) {
    if(j+1>=8||i+2>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i+1][j+1]=='0') return false;
    if(grid[i+2][j+1]=='0') return false;
    return true;
}
bool is_G(int i,int j) {
    if(i-2<0||j-1<0) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i-1][j]=='0') return false;
    if(grid[i-1][j-1]=='0') return false;
    if(grid[i-2][j-1]=='0') return false;
    return true;
}
void solve() {
    rep(i,8) rep(j,8) {

        if(is_A(i,j)) {
            cout<<"A"<<endl;
            return;
        }
        if(is_B(i,j)) {
            cout<<"B"<<endl;
            return;
        }
        if(is_C(i,j)) {
            cout<<"C"<<endl;
            return;
        }
        if(is_D(i,j)) {
            cout<<"D"<<endl;
            return;
        }
        if(is_E(i,j)) {
            cout<<"E"<<endl;
            return;
        }
        if(is_F(i,j)) {
            cout<<"F"<<endl;
            return;
        }
        if(is_G(i,j)) {
            cout<<"G"<<endl;
            return;
        }
        if(is_B(i,j)) {
            cout<<"B"<<endl;
            return;
        }
        if(is_B(i,j)) {
            cout<<"B"<<endl;
            return;
        }
    }

    cout<<"hoge"<<endl;
}
int main() {
    while(cin>>grid[0]) {
        rep(i,7) cin>>grid[i+1];
        solve();

    }
    return 0;
}

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

using namespace std;

constexpr size_t SIZE = 8;
constexpr size_t PATTERN = 7;

const array<string, PATTERN> pattern = {
    "1100000011", "1000000010000000100000001", "1111",
    "1000000110000001", "11000000011",
    "100000001100000001", "110000011"};

string surface;

char choice();

int main()
{
    while (true) {
        surface = "";

        for (size_t row = 0; row < SIZE; row++) {
            string buf;
            cin >> buf;

            surface += buf;
        }

        cout << choice() << endl;

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

    return 0;
}

char choice()
{
    for (size_t i = 0; i < PATTERN; i++) {
        if (surface.find(pattern.at(i), 0) != string::npos) {
            return static_cast<char>('A' + i);
        }
    }
    return 'G';
}

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

using namespace std;

int main(void)
{
	string s,shape[7];
	string tmp;
	shape[0]="1100000011";
	shape[1]="1000000010000000100000001";
	shape[2]="1111";
	shape[3]="1000000110000001";
	shape[4]="11000000011";
	shape[5]="100000001100000001";
	shape[6]="110000011";
	while(cin>>s)
	{
		for(int i=0;i<7;i++)
		{
			cin>>tmp;
			s+=tmp;
		}
		for(int i=0;i<7;i++)
		{
			if(s.find(shape[i])!=string::npos)
			{
				cout<<(char)('A'+i)<<endl;
			}
		}
		cin>>s;
	}
}