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
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

struct P{ double x, y; };

bool Range(int x, int y)
{ return 0 <= x && x < 8 && 0 <= y && y < 8; }

const int target[7][3][2] = 
{
	{{1, 0}, {0, 1}, {1, 1}},
	{{0, 1}, {0, 2}, {0, 3}}, 
	{{1, 0}, {2, 0}, {3, 0}},
	{{0, 1}, {-1,1}, {-1,2}},
	{{1, 0}, {1, 1}, {2, 1}},
	{{0, 1}, {1, 1}, {1, 2}},
	{{1, 0}, {0, 1}, {-1,1}}
};



char solve(vector<string>& field)
{
	rep(x, 8) rep(y, 8) rep(t, 7)
	{
		if(Range(x, y) && field[y][x] == '1')
		rep(p, 3)
		{
			int nx = x + target[t][p][0], ny = y + target[t][p][1];
			if(!Range(nx, ny) || field[ny][nx] != '1')
				break;
			else if(p == 2)
			{
				return 'A' + t;
			}
		}
	}

	return 'Z';
}



int main()
{
	while(!cin.eof())
	{	
		vector<string> field;

		rep(i, 8)
		{
			string str;
			cin >> str;
			field.push_back(str);
		}


		cout << solve(field) << endl;
	}
}

C++: #include <iostream>
#include <string.h>

#define MAX_LINE 8
#define MAXA_DATA 50

using namespace std;

// プロトタイプ宣言
void searchString(string box);

// main関数
int main() {
    int count = 0;
    int max = MAX_LINE * MAXA_DATA;
    char str[8];
    string box;
    for (int i = 0; i < max; i++) {
        cin >> str;
        box.append(str);
        count++;
        // 8行ごとにチェック
        if(count%MAX_LINE == 0){
            searchString(box);
            box = "";
        }
    }
}

// 文字列チェック
void searchString(string box){
    string A("1100000011");
    string B("1000000010000000100000001");
    string C("1111");
    string D("1000000110000001");
    string E("11000000011");
    string F("100000001100000001");
    string G("110000011");
    
    // find関数は文字列がみつからなかったときにnposを返す
    if (box.find(A) != std::string::npos) {
        cout << "Aえ" << endl;
    }
    else if(box.find(B) != std::string::npos) {
        cout << "B" << endl;
    }
    else if(box.find(C) != std::string::npos) {
        cout << "C" << endl;
    }
    else if(box.find(D) != std::string::npos) {
        cout << "D" << endl;
    }
    else if(box.find(E) != std::string::npos) {
        cout << "E" << endl;
    }
    else if(box.find(F) != std::string::npos) {
        cout << "F" << endl;
    }
    else if(box.find(G) != std::string::npos) {
        cout << "G" << endl;
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){

	while(1){
		int data[7]={22,60,6,38,24,42,20},a=0,b=0,sum=0;
		char x;
		rer(i,1,8){
			rer(j,1,8){
				if(~(cin>>x)) return 0;
				//if(cin.eof()) return 0;//!!!!!!!
				if(x=='1'){
					if(a==0 && b==0){
						a=i; b=j;
					}else{
						sum+=10*(i-a)+j-b;
					}
				}
				//o(sum);
			}
		}
		rep(i,0,7){
			if(sum==data[i]){
				char c;
				c='A'+i;
				o(c); break;
			}
		}
	}
}

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

struct Point{
public:
	int x,y;
	Point(int _x, int _y){x=_x;y=_y;}
	void show(){cout<<x<<","<<y<<endl;}
	bool eq(Point &a){return x==a.x && y==a.y;}
};

bool eqFig(vector<Point> &a, vector<Point> &b){
	if(a.size()!=b.size()){
		return false;
	}else{
		vector<Point>::iterator ita=a.begin(), itb=b.begin();
		for(;ita<a.end();++ita,++itb){
			if(!(ita->eq(*itb))){
				return false;
			}
		}
		return true;
	}
}

int main() {
	Point fig_a[4] = {Point(0,0),Point(1,0),Point(0,1),Point(1,1)};
	Point fig_b[4] = {Point(0,0),Point(0,1),Point(0,2),Point(0,3)};
	Point fig_c[4] = {Point(0,0),Point(1,0),Point(2,0),Point(3,0)};
	Point fig_d[4] = {Point(0,0),Point(-1,1),Point(0,1),Point(-1,2)};
	Point fig_e[4] = {Point(0,0),Point(1,0),Point(1,1),Point(2,1)};
	Point fig_f[4] = {Point(0,0),Point(0,1),Point(1,1),Point(1,2)};
	Point fig_g[4] = {Point(0,0),Point(1,0),Point(-1,1),Point(0,1)};
	vector<Point> _figs[7] = {vector<Point>(fig_a,fig_a+4),
		vector<Point>(fig_b,fig_b+4),
		vector<Point>(fig_c,fig_c+4),
		vector<Point>(fig_d,fig_d+4),
		vector<Point>(fig_e,fig_e+4),
		vector<Point>(fig_f,fig_f+4),
		vector<Point>(fig_g,fig_g+4)
	};
	vector< vector<Point> > figs(_figs,_figs+7);
	vector<Point>fig;
	unsigned char ch;
	
	do{
		fig.clear();
		int x=0,y=0,sx;
		bool flg=false;
		
		for(int i=0;i<8;++i){
			for(int j=0;j<8;++j){
				ch = getchar();
				if(ch == '1'){
					fig.push_back(Point(x,y));
					if(!flg)sx = j;
					flg = true;
				}
				if(flg){
					x = 1 + j - sx;
				}
			}
			if(flg)++y;
			getchar();
		}
		
		for(int i=0;i<7;++i){
			if(eqFig(figs[i],fig)){
				cout<<(char)('A'+i)<<endl;
				break;
			}
		}
		
	}while(getchar()!=EOF);
	return 0;
}