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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

char judge( vector<string> surface )
{
	for ( unsigned int i = 0; i < surface.size(); i++ )
	{
		for ( unsigned int j = 0; j < surface[i].length(); j++ )
		{
			if ( surface[i][j] == '1' )
			{
				// A
				if ( surface[i][j+1] == '1' && surface[i+1][j] == '1' && surface[i+1][j+1] == '1' )
				{
					return 'A';
				}
				// B
				else if ( surface[i+1][j] == '1' &&surface[i+2][j] == '1' &&surface[i+3][j] == '1' )
				{
					return 'B';
				}
				// C
				else if ( surface[i][j+1] == '1' && surface[i][j+2] == '1' && surface[i][j+3] == '1' )
				{
					return 'C';
				}
				// D
				else if ( surface[i+1][j] == '1' && surface[i-1][j-1] == '1' && surface[i-2][j-1] == '1' )
				{
					return 'D';
				}
				// E
				else if ( surface[i][j+1] == '1' && surface[i+1][j+1] == '1' && surface[i+1][j+2] == '1' )
				{
					return 'E';
				}
				// F
				else if ( surface[i+1][j] == '1' && surface[i+1][j+1] == '1' && surface[i+2][j+1] == '1' )
				{
					return 'F';
				}
				// G
				else if ( surface[i+1][j+1] == '1' && surface[i-1][j-1] == '1' && surface[i+1][j] == '1' )
				{
					return 'G';
				}
				else
				{
					return '-';
				}
			}
		}
	}

	return '-';
}

int main()
{
	while ( true )
	{
		string buffer;
		vector<string> surface;

		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );

		for ( int i = 0; i < 8; i++ )
		{
			if ( cin >> buffer )
			{
				surface.push_back( "000" + buffer + "000" );
			}
			else
			{
				return 0;
			}
		}

		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );
		surface.push_back( "00000000000000" );

		cout << judge( surface ) << endl;
	}
	
	return 0;
}

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

int main() {

  int map[14][14] = {0};
  char input;

  while(true) {

    bool flag = false;
    for ( int i = 3; i < 11; i++ ) {

      for ( int j = 3; j < 11; j++ ) {

	cin >> input;
	if ( cin.eof() ) {
	  flag = true;
	  break;
	}
	map[j][i] = input - '0';

      }
      if ( flag ) break;

    }
    if ( flag ) break;

    for ( int i = 3; i < 11; i++ ) {
      for ( int j = 3; j < 11; j++ ) {

	if ( map[j][i] != 0 ) {
	  if ( map[j][i+3] != 0 ) {
	    cout << "B";
	  }else if ( map[j+3][i] != 0 ) {
	    cout << "C";
	  }else if ( map[j-1][i+2] != 0 ) {
	    cout << "D";
	  }else if ( map[j+2][i+1] != 0 ) {
	    cout << "E";
	  }else if ( map[j+1][i+2] != 0 ) {
	    cout << "F";
	  }else if ( map[j-1][i+1] != 0 ) {
	    cout << "G";
	  }else {
	    cout << "A";
	  }
	  cout << endl;
	  flag = true;
	  break;
	}

      }
      if ( flag ) break;
    }

  }

  return 0;

}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

string s[7][4] =
{
	{
		"1100",
		"1100",
		"0000",
		"0000"
	},
	{
		"1000",
		"1000",
		"1000",
		"1000"
	},
	{
		"1111",
		"0000",
		"0000",
		"0000"
	},
	{
		"0100",
		"1100",
		"1000",
		"0000"
	},
	{
		"1100",
		"0110",
		"0000",
		"0000"
	},
	{
		"1000",
		"1100",
		"0100",
		"0000"
	},
	{
		"0110",
		"1100",
		"0000",
		"0000"
	}
};
string Add = "00000000000";

int main() {
	string str;
	while ( cin >> str ) {
		VS d;
		d.push_back( str + "000" );
		for ( int i = 0; i < 7; i++ ) {
			cin >> str;
			d.push_back( str + "000" );
		}
		d.push_back( Add );
		d.push_back( Add );
		d.push_back( Add );
		bool break_check = false;
		for ( int i = 0; i < 8; i++ ) {
			for ( int j = 0; j < 8; j++ ) {
				for ( int k = 0; k < 7; k++ ) {
					break_check = true;
					for ( int l = i; l < i + 4; l++ ) {
						if ( d[ l ].substr( j, 4 ) != s[ k ][ l - i ] ) {
							break_check = false;
							break;
						}
					}
					if ( break_check ) {
						printf( "%c\n", k + 'A' );
						break;
					}
				}
				if ( break_check ) {
					break;
				}
			}
			if ( break_check ) {
				break;
			}
		}
	}
	return 0;
}