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 <iostream>
using namespace std;

int main()
{
	while(!cin.eof())
	{
		long a[8] = {0};
		for(int i = 0; i < 8; i++)
		{
			long x;
			cin >> x;
			for(int j = 0; j < 8; j++)
			{
				a[i] += (x % 10) << j;
				x /= 10;
			}
		}

		char c = 'A';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'B';
		for(int i = 0; i < 5; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == (1 << j))
					if(a[i + 1] == (1 << j))
					{
						//cout << "B " << (1 << j) << endl;
						goto END;
					}

		c = 'C';
		for(int i = 0; i < 8; i++)
			for(int j = 0; j < 5; j++)
			{
				//cout << 'C' << ' ' << (15 << j) << endl;
				if(a[i] == 15 << j)
					goto END;

			}
		c = 'D';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 1 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'E';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << (j-1))
						goto END;

		c = 'F';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == 1 << j)
					goto END;

		c = 'G';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 6; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << (j + 1))
						goto END;

		cout << "error" << endl;
		break;

	END:
		cout << c << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

struct Pt { int x, y; };

const int fld = 8;
const vector<vector<Pt>> fig = { // offset
	{ {0,0},{1,0},{-1,1},{1,0} },
	{ {0,0},{0,1},{0,1},{0,1} },
	{ {0,0},{1,0},{1,0},{1,0} },
	{ {0,0},{0,1},{-1,0},{0,1} },
	{ {0,0},{1,0},{0,1},{1,0} },
	{ {0,0},{0,1},{1,0},{0,1} },
	{ {0,0},{1,0},{-2,1},{1,0} }
};

bool match( const vector<string>& a, int x, int y, int fig_i ) {
	for( int i = 0; i < 4; ++i ) {
		x += fig[fig_i][i].x;
		y += fig[fig_i][i].y;

		if( x < 0 || y < 0 || x >= fld || y >= fld || a[y][x] == '0' ) {
			return false;
		}
	}

	return true;
}

int check( const vector<string>& a ) {
	for( int i = 0; i < fld; ++i ) {
		for( int j = 0; j < fld; ++j ) {
			for( int k = 0; k < fig.size(); ++k ) {
				if( match( a, j, i, k ) ) { return k; }
			}
		}
	}

	return -1;
}

int main() {
	ios_base::sync_with_stdio( false );

	vector<string> a;
	string s;
	while( cin >> s ) {
		a.push_back( s );

		if( a.size() == fld ) {
			cout << (char)('A' + check( a )) << '\n';
			a.clear();
		}
	}

	return 0;
}

C++: #include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<string> v;
vector<string> f[7] = {
	{"11", "11"},
	{"1", "1", "1", "1"},
	{"1111"},
	{"01", "11", "10"},
	{"110", "011"},
	{"10", "11", "01"},
	{"011", "110"}
};
bool contain(vector<string> v1, vector<string> v2) {
	for(int i = 0; i <= (int)(v1.size() - v2.size()); i++) {
		for(int j = 0; j <= (int)(v1[0].size() - v2[0].size()); j++) {
			bool flag = true;
			for(int k = 0; k < v2.size(); k++) {
				if(v1[i + k].substr(j, v2[0].size()) != v2[k]) {
					flag = false; break;
				}
			}
			if(flag) return true;
		}
	}
	return false;
}
int main() {
	v.resize(8);
	while(cin >> v[0] >> v[1] >> v[2] >> v[3] >> v[4] >> v[5] >> v[6] >> v[7]) {
		for(int i = 0; i < 7; i++) {
			if(contain(v, f[i])) cout << (char)(i + 65) << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int pattern[7][4][2] = {
					{ { 0, 0 }, { 0, 1 }, { 1, 0 }, { 1, 1 } },	// A
					{ { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 } },	// B
					{ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 } },	// C
					{ { 0, 0 }, { 1, 0 }, { 1,-1 }, { 2,-1 } },	// D
					{ { 0, 0 }, { 0, 1 }, { 1, 1 }, { 1, 2 } },	// E
					{ { 0, 0 }, { 1, 0 }, { 1, 1 }, { 2, 1 } },	// F
					{ { 0, 0 }, { 0, 1 }, {-1, 1 }, {-1, 2 } }};	// G
int grid[8][8];

int main()
{
//	cut here before submit 
//	freopen ("testcase.FS", "r", stdin );
	bool end = false;
	while (1 ){
		memset (grid, 0, sizeof (grid ) );
		string str = "";
		rep (i, 8 ){
			if (getline (cin, str ) ){
				rep (j, 8 ){
					grid[i][j] = (int)(str[j] - '0' );
				} // end rep
			}else{
				end = true;
				break;
			} // end if
		} // end rep
		if (end ) break;
		int res = 0;
		bool found = false;
		rep (row, 8 ){
			rep (col, 8 ){
				if (grid[row][col] == 1 ){
					rep (p, 7 ){
						bool ok = true;
						rep (k, 4 ){
							int nr = row + pattern[p][k][0];
							int nc = col + pattern[p][k][1];
							if (nr < 0 || nr >= 8 || nc < 0 || nc >= 8 || grid[nr][nc] == 0 ){
								ok = false;
								break;						
							} // end if
						} // end rep
						if (ok ){
							res = p;
							found = true;
							break;
						} // end if
					} // end rep
				} // end if
				if (found ) break;
			} // end rep
			if (found ) break;
		} // end rep

		cout << (char)(res + 'A' ) << endl;
		getline (cin, str );
	} // end loop
		
	return 0;
}