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 < 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<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;

    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;

    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;

    REP(i,7)REP(j,6)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;

    REP(i,6)REP(j,7)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;

    REP(i,7)REP(j,6)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;

    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;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
string str[8]; 
void ans(int i,int k){
	if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k] == '1' ){
		cout << "A" << endl;  
		} else if(str[i+1][k] == '1' && str[i+2][k] == '1'&& str[i+3][k] == '1' ){
		cout << "B" << endl; 
		} else if(str[i][k+1] == '1' && str[i][k+2] == '1'&& str[i][k+3] == '1' ){
		cout << "C" << endl;  
		} else if(str[i+1][k] == '1' && str[i+1][k-1] == '1'&& str[i+2][k-1] == '1' ){
		cout << "D" << endl; 
		} else if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k+2] == '1' ){
		cout << "E" << endl; 
		} else if(str[i+1][k] == '1' && str[i+1][k+1] == '1'&& str[i+2][k+1] == '1' ){
		cout << "F" << endl;  
		} else if(str[i][k+1] == '1' && str[i+1][k] == '1'&& str[i+1][k-1] == '1' ){
		cout << "G" << endl; 
		}



}

int main(){
	
	while(1){
	
	for(int i =0;i<8;i++)
		cin >> str[i];
	
	
	for(int i=0;i<64;i++)
	
	if(str[i/8][i%8] == '1')
	ans(i/8,i%8);
	
	if (cin.eof())
    break;
	
	}
	
}

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

int main()
{
	while(!cin.eof())
	{
		if(cin.eof())
			break;
		long a[8] = {0};
		for(int i = 0; i < 8; i++)
		{
			long x;
			cin >> x;
			for(int j = 0; j < 8; j++)
			{
				a[i] += (x % 10) << j;
				x /= 10;
			}
		}

		/*for(int i = 0; i < 8; i++)
			cout << i << ' ' << a[i] << endl;
		*/

		char c = 'A';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'B';
		for(int i = 0; i < 5; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == (1 << j))
					if(a[i + 1] == (1 << j))
					{
						//cout << "B " << (1 << j) << endl;
						goto END;
					}

		c = 'C';
		for(int i = 0; i < 8; i++)
			for(int j = 0; j < 5; j++)
			{
				//cout << 'C' << ' ' << (15 << j) << endl;
				if(a[i] == 15 << j)
					goto END;

			}
		c = 'D';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 1 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'E';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << (j-1))
						goto END;

		c = 'F';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == 1 << j)
					goto END;

		c = 'G';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 6; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << (j + 1))
						goto END;

		break;

	END:
		cout << c << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	while (cin >> s) {
		vector<string>v;
		v.push_back(s);
		rep(i, 0, 7) {
			string t; cin >> t;
			v.push_back(t);
		}
		char ans;
		rep(i, 0, 8) {
			rep(j, 0, 8) {
				if (v[i][j] == '1') {
					if (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1')ans = 'A';
					else if (v[i + 1][j] == '1'&&v[i + 2][j] == '1'&&v[i + 3][j] == '1')ans = 'B';
					else if (v[i][j + 1] == '1'&&v[i][j + 2] == '1'&&v[i][j + 3] == '1')ans = 'C';
					else if (v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1'&&v[i + 2][j - 1] == '1')ans = 'D';
					else if (v[i][j + 1] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 1][j + 2] == '1')ans = 'E';
					else if (v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 2][j + 1] == '1')ans = 'F';
					else if (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i - 1][j - 1] == '1')ans = 'G';
					goto here;
				}
			}
		}
	here:;
		cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <string>
using namespace std;
struct P {int x, y; char s[4][5];};
char f[8][9] = {{""}};
bool c(int x, int y, P p)
{
	int i, j;
	char t[8][9];
	for (i = 0; i < 8; i++)
		strcpy(t[i], f[i]);
	for (i = 0; i < p.y; i++)
	{
		for (j = 0; j < p.x; j++)
		{
			t[y+i][x+j] = p.s[i][j];
		}
	}
	for (i = 0; i < 8; i++)
		if (strcmp(t[i], f[i]) != 0)
		{
			return false;
		}
	return true;
}
int main()
{
	P p[7] = {2, 2, {"11", "11"},
		1, 4, {"1", "1", "1", "1"},
		4, 1, {"1111"},
		2, 3, {"01", "11", "10"},
		3, 2, {"110", "011"},
		2, 3, {"10", "11", "01"},
		3, 2, {"011", "110"}};
	int i, j, k;
	bool b;
	char res;
	string t;
	while (!cin.eof())
	{
		for (i = 0; i < 8; i++)
			cin >> f[i];
		cin.ignore();
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 8; j++)
			{
				for (k = 0; k < 7; k++)
				{
					if (8-j >= p[k].x && 8-i >= p[k].y)
						if (b = c(j, i, p[k]))
							res = 'A' + k;
				}
				if (b) break;
			}
			if (b) break;
		}
		cout << res << endl;
	}
}