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(), "")
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			break
		}
		fmt.Println(board)
		for i := 0; i < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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<bits/stdc++.h>
using namespace std;
int main(){
	char input[8][8];
	int line;
	int zero;
	int tmp;
	bool flag;
	bool is,end;
	while(gets(input[0])){
		for(int i=1;i<8;i++)
			gets(input[i]);
		line=0;
		zero=0;
		flag=false;
		end=false;
		for(int i=0;i<8;i++){
			is=false;
			for(int j=0;j<8;j++){
				if(input[i][j]=='1'){
					is=true;
					flag=true;
					if(zero)
						end=true;
				}
				if(flag&&!end){
					if(input[i][j]=='0')
						zero++;
				}	
			}
			if(is)
				line++;
		}
		if(line==4)
			cout<<"B"<<endl;
		else if(line==1)
			cout<<"C"<<endl;
		else if(line==2){
			if(zero==6)
				cout<<"A"<<endl;
			else if(zero==7)
				cout<<"E"<<endl;
			else if(zero==5)
				cout<<"G"<<endl;
		}else{
			if(zero==7)
				cout<<"F"<<endl;
			else
				cout<<"D"<<endl;
		}
		getchar();
	}
}

C++: #include<iostream>
#include<vector>
int main(){
	std::vector<std::vector<int> > vec(8,std::vector<int>(8));
	while(1){
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				std::cin>>vec[i][j];
			}
		}
		if(std::cin.eof())break;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(vec[i][j]==1){
					if(vec[i][j+1]==1&&vec[i+1][j]==1&&vec[i+1][j+1]==1)std::cout<<"A"<<std::endl;
					if(vec[i+1][j]==1&&vec[i+2][j]==1&&vec[i+3][j]==1)std::cout<<"B"<<std::endl;
					if(vec[i][j+1]==1&&vec[i][j+2]==1&&vec[i][j+3]==1)std::cout<<"C"<<std::endl;
					if(vec[i+1][j]==1&&vec[i+1][j-1]==1&&vec[i+2][j-1]==1)std::cout<<"D"<<std::endl;
					if(vec[i][j+1]==1&&vec[i+1][j+1]==1&&vec[i+1][j+2]==1)std::cout<<"E"<<std::endl;
					if(vec[i+1][j]==1&&vec[i+1][j+1]==1&&vec[i+2][j+1]==1)std::cout<<"F"<<std::endl;
					if(vec[i][j+1]==1&&vec[i+1][j]==1&&vec[i+1][j-1]==1)std::cout<<"G"<<std::endl;
				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int kaizyo(int x){
    if(x==1)return x;
    else return x*kaizyo(x-1);
}


int main() {
    vector<vector<char>> v(8,vector<char>(8));
    while(cin>>v[0][0]){
        rep(i,1,8)cin>>v[0][i];
    rep(i,1,8)rep(j,0,8)cin>>v[i][j];
    rep(i,0,8){
        rep(j,0,8){
            if(v[i][j]=='1'){
                //cout<<9<<endl;
                if(v[i][j+1]=='1'&&v[i+1][j]=='1'&&v[i+1][j+1]=='1'){cout<<"A"<<endl;goto AWAY;}
                if(v[i+1][j]=='1'&&v[i+1][j-1]=='1'&&v[i+2][j-1]=='1'){cout<<"D"<<endl;goto AWAY;}
                if(v[i][j+1]=='1'&&v[i+1][j+2]=='1'&&v[i+1][j+1]=='1'){cout<<"E"<<endl;goto AWAY;}
                if(v[i][j+1]=='1'&&v[i+2][j+1]=='1'&&v[i+1][j+1]=='1'){cout<<"F"<<endl;goto AWAY;}
                if(v[i][j+1]=='1'&&v[i+1][j]=='1'&&v[i+1][j-1]=='1'){cout<<"G"<<endl;goto AWAY;}
                if(v[i+3][j]=='1'){cout<<"B"<<endl;goto AWAY;}
                if(v[i][j+3]=='1'){cout<<"C"<<endl;goto AWAY;}
            }
        }
    }
    AWAY:;
    v.clear();
    //v.resize(8,vector<int>(8));
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

bool find(const vvi& a,const vvi& fig)
{
	rep(i,9-fig.size()){
		rep(j,9-fig[0].size()){
			bool ok=true;
			rep(k,fig.size()){
				rep(l,fig[0].size()){
					if(a[i+k][j+l]!=fig[k][l])
						ok=false;
				}
			}
			if(ok)
				return true;
		}
	}
	return false;
}

int main()
{
	vector<vvi> fig(7);
	fig[0]=vvi(2,vi(2));
	fig[0][0][0]=fig[0][0][1]=fig[0][1][0]=fig[0][1][1]=1;
	fig[1]=vvi(4,vi(1));
	fig[1][0][0]=fig[1][1][0]=fig[1][2][0]=fig[1][3][0]=1;
	fig[2]=vvi(1,vi(4));
	fig[2][0][0]=fig[2][0][1]=fig[2][0][2]=fig[2][0][3]=1;
	fig[3]=vvi(3,vi(2));
	fig[3][0][1]=fig[3][1][0]=fig[3][1][1]=fig[3][2][0]=1;
	fig[4]=vvi(2,vi(3));
	fig[4][0][0]=fig[4][0][1]=fig[4][1][1]=fig[4][1][2]=1;
	fig[5]=vvi(3,vi(2));
	fig[5][0][0]=fig[5][1][0]=fig[5][1][1]=fig[5][2][1]=1;
	fig[6]=vvi(2,vi(3));
	fig[6][0][1]=fig[6][0][2]=fig[6][1][0]=fig[6][1][1]=1;
	for(string s;cin>>s;){
		vvi a(8,vi(8));
		rep(i,8)
			a[0][i]=s[i]-'0';
		repi(i,1,8){
			cin>>s;
			rep(j,8)
				a[i][j]=s[j]-'0';
		}
		rep(i,fig.size()){
			if(find(a,fig[i])){
				cout<<char(i+'A')<<endl;
				break;
			}
		}
	}
	
	return 0;
}