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)
		fmt.Scanln()
	}
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/


char grid[15][15];

char solve(int i,int j){
    if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i][j+1]=='1'&&grid[i+1][j+1]=='1'){
        return 'A';
    }
    if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+2][j]=='1'&&grid[i+3][j]=='1'){
        return 'B';
    }
    if(grid[i][j]=='1'&&grid[i][j+1]=='1'&&grid[i][j+2]=='1'&&grid[i][j+3]=='1'){
        return 'C';
    }
    if(grid[i][j]=='1'&&grid[i][j+1]=='1'&&grid[i+1][j+1]=='1'&&grid[i+1][j+2]=='1'){
        return 'E';
    }
    if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+1][j+1]=='1'&&grid[i+2][j+1]=='1'){
        return 'F';
    }
    if(j>0){
        if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+1][j-1]=='1'&&grid[i+2][j-1]=='1'){
            return 'D';
        }
        if(grid[i][j]=='1'&&grid[i+1][j]=='1'&&grid[i+1][j-1]=='1'&&grid[i][j+1]=='1'){
            return 'G';
        }
    }
    return 0;
}
int main()
{
	while (!cin.eof())
	{
		rep(i, 15)
		{
			rep(j, 15)
			{
				grid[i][j] = '0';
			}
		}
		
		rep(i, 8)
		{
			cin >> grid[i];
		}
		
		char ans;
		bool solved = true;
		
		rep(i, 8)
		{
			rep(j, 8)
			{
				if (grid[i][j] == '1')
				{
					if (solved)
					{
						ans = solve(i, j);
						cout << ans << endl;
						solved = false;
					}
				} else {
					continue;
				}
			}
		}
	}
	
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<vector>

using namespace std;

int main(){
    const int mapsize = 64;
    vector<char> sur(mapsize);
    const int fig[] = {9, 24, 3, 15, 10, 16, 8};

    while(cin>>sur[0]){
    for(int i=1; i<mapsize; i++){
        cin>> sur[i];
    }


    int k=0, cnt=0;
    for(int i=0; i<mapsize; i++){
        if(sur[i]==49){
            k++;
            if(k==4) break;
        }
        if(k!=0){
            cnt++;
        }
    }

    for(int i=0; i<7; i++){
        if(fig[i] == cnt){
            printf("%c\n", 65+i);
        }
    }
    }

    return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
const double eps=1e-10;
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;



signed main(){
  string s[10];
  while(cin>>s[0]){
    REP(i,7)cin>>s[i+1];

    REP(i,7)REP(j,7){
      if(s[i][j]=='1'&&s[i][j+1]=='1'&&s[i+1][j]=='1'&&s[i+1][j+1]=='1'){
        cout<<"A"<<endl;
        break;
      }
    }

    REP(i,5)REP(j,8){
      if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+2][j]=='1'&&s[i+3][j]=='1'){
        cout<<"B"<<endl;
        break;
      }
    }

    REP(i,8)REP(j,5){
      if(s[i][j]=='1'&&s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i][j+3]=='1'){
        cout<<"C"<<endl;
        break;
      }
    }

    REP(i,6)REP(j,7){
      if(s[i][j+1]=='1'&&s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j]=='1'){
        cout<<"D"<<endl;
        break;
      }
    }

    REP(i,7)REP(j,6){
      if(s[i][j]=='1'&&s[i][j+1]=='1'&&s[i+1][j+1]=='1'&&s[i+1][j+2]=='1'){
        cout<<"E"<<endl;
        break;
      }
    }

    REP(i,6)REP(j,7){
      if(s[i][j]=='1'&&s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j+1]=='1'){
        cout<<"F"<<endl;
        break;
      }
    }

    REP(i,6)REP(j,7){
      if(s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i+1][j]=='1'&&s[i+1][j+1]=='1'){
        cout<<"G"<<endl;
        break;
      }
    }
  }
  return 0;
}

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()
{
	ifstream ifs("data.txt");

	while(!ifs.eof())
	{	
		vector<string> field;

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


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