Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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 <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;
	}
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

/*
A 2*2 B 1*4 C 4*1 D 01 E 110 F 10 G 011
                    11   011   11   110
                    10         01
*/

int main() {
	while (true) {
		string in[4];
		string tmp;
		int j=0;
		for (int i=0; i<8; i++) {
			cin >> tmp;
			if (tmp != "00000000") {
				in[j] = tmp;
				j++;
			}
		}
		scanf("\n");
		if (j == 4) {
			cout << "B" << endl;
		} else if (j == 1) {
			cout << "C" << endl;
		} else if (j == 2) {
			if (in[0] == in[1]) {
				cout << "A" << endl;
			} else if (in[0] > in[1]) {
				cout << "E" << endl;
			} else {
				cout << "G" << endl;
			}
		} else {
			if (in[0] > in[1]) {
				cout << "F" << endl;
			} else {
				cout << "D" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
struct Rect
{
	Rect(){
		minX = minY = 10000;
		maxX = maxY = -10000;
	}
	void add(int i, int j){
		if (minX > i) minX = i;
		if (minY > j) minY = j;
		if (maxX < i) maxX = i;
		if (maxY < j) maxY = j;
	}
	int getWidth() {
		return (maxY - minY + 1);
	}
	int getHeight() {
		return (maxX - minX + 1);
	}
	int minX;
	int minY;
	int maxX;
	int maxY;
};
int main()
{
	char c;
	int A[8][8] = {};
	while (true){
		Rect r;
		for (int i = 0; i < 8; ++i){
			for (int j = 0; j < 8; ++j){
				cin.get(c);
				if (c == '1') A[i][j] = 1;
				else A[i][j] = 0;
				if (1 == A[i][j])
					r.add(i, j);
			}
			cin.get(c);
		}
		int w = r.getWidth();
		int h = r.getHeight();
		if (1 == w) cout << "B\n";
		else if (1 == h) cout << "C\n";
		else if (2 == w && 2 == h) cout << "A\n";
		else if (2 == w && 3 == h){
			if (A[r.minX][r.minY] == 1) cout << "F\n";
			else cout << "D\n";
		}
		else if (3 == w && 2 == h){
			if (A[r.minX][r.minY] == 1) cout << "E\n";
			else cout << "G\n";
		}
		if (!cin.get(c))
			break;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

char mass[16][16];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    bool f;
    
    while (!cin.eof()) {
        f = false;
        
        rep(i, 16) {
            rep(j, 16) {
                mass[i][j] = '0';
            }
        }

        rep(i, 8) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}