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>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



int MAX = 8;

int main() {
	vector< vcs > b(7);
	b[0].pb("11"); b[0].pb("11");
	b[1].pb("1"); b[1].pb("1"); b[1].pb("1"); b[1].pb("1");
	b[2].pb("1111");
	b[3].pb("01"); b[3].pb("11"); b[3].pb("10");
	b[4].pb("110"); b[4].pb("011");
	b[5].pb("10"); b[5].pb("11"); b[5].pb("01");
	b[6].pb("011"); b[6].pb("110");
	
	vcs m(MAX);
	string tes;
	
	while (cin >> tes) {
		if (tes=="") continue;
		
		m[0] = tes;
		for_(i, 1, MAX) cin >> m[i];
	
		for_(k, 0, 7) {
			vcs bl = b[k];
			int Y = (int)bl[0].sz, X = (int)bl.sz;
		
			bool flag = false;
			for_(i, 0, MAX-X+1) for_(j, 0, MAX-Y+1){
				bool f = true;
				for_(x, 0, X) for_(y, 0, Y) {
					if (m[i+x][j+y] != bl[x][y]) f = false;				
				}
				if (f) flag = true;
			}
		
			if (flag) {
				char ans = 'A' + k;
				cout << ans << endl;
				break;
			}
		}
	}
	
	return 0;
}

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

int G[8][8];

bool in_range(int a,int b){
  return 0<= a && a < 8 && 0 <= b && b < 8;
}

void check(int x,int y)
{
  char res = 'A';
  if(in_range(y - 3,x)&&G[x][y - 3])res = 'B';
  else if(in_range(y,x - 3)&&G[x - 3][y])res = 'C';
  else if(in_range(y - 2,x+1 )&&G[x + 1][y  - 2])res = 'D';
  else if(in_range(y - 1,x-2 )&&G[x - 2][y  - 1])res = 'E';
  else if(in_range(y - 2,x-1 )&&G[x - 1][y  - 2])res = 'F';
  else if(in_range(y - 1,x+1 )&&G[x + 1 ][y  - 1])res = 'G';
  cout << res << endl;
}

int main(){
  int sx,sy;
  char c;
  for(int i = 0 ; i < 8 ; i++ ){
    for(int j = 0 ; j < 8 ; j++ ){
      cin >> c;
      G[j][i] = c - '0';
    if(G[j][i] == 1){
      sx = j;
      sy = i;
    }
    }
  }
  check(sx,sy);
}

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

char c[8][12];

int find(){
    int i = 0;
    while( c[i/8][i%8] == '0' ) i++;
    return i;
}

int main(){
    const char O = '1', Z = '0';
    while( true ){
        int i = 0;
        while( i < 8 && scanf("%s", c[i]) != EOF ){
            i++;
        }
        if( i < 8 ) break;
        int p = find();
        if( c[p/8][p%8+1] == O && c[p/8+1][p%8] == O ){
            if( c[p/8+1][p%8+1] == O ) puts("A");
            else puts("G");
        }
        if( c[p/8+2][p%8] == O ) puts("B");
        if( c[p/8][p%8+2] == O ) puts("C");
        if( c[p/8+1][p%8] == O && c[p/8+2][p%8] == Z &&
            c[p/8][p%8+1] == Z ){
            if( c[p/8+1][p%8+1] == Z ) puts("D");
            else puts("F");
        }
        if( c[p/8+1][p%8] == Z && c[p/8+1][p%8+1] == O ) puts("E");
        scanf("");
    }
    return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
char s[100][100];
int main(){
	

	while(cin>>s[1][1]){
		string a;
		for(int j=2;j<8;j++){
			cin>>s[1][j];
		}
		for(int i=2;i<=8;i++){
			for(int j=1;j<=8;j++){
				cin>>s[i][j];
			}
		}
		for(int y=1;y<=8;y++){
			for(int x=1;x<=8;x++){
		if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1')
			cout<<"A"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+2][x]=='1'&&s[y+3][x]=='1')
			cout<<"B"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y][x+2]=='1'&&s[y][x+3]=='1')
			cout<<"C"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1'&&s[y+2][x-1]=='1')
			cout<<"D"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1'&&s[y+1][x+2]=='1')
			cout<<"E"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x+1]=='1'&&s[y+2][x+1]=='1')
			cout<<"F"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1')
			cout<<"G"<<endl;
			}
		}
		cin>>a;
	}
}