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 <cstdio>
#define REP(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
char m[16][16], buf[16];
int main()
{
	while (true) {
		bool done = false;
		rep(i, 8) if (scanf("%s", m[i]) == EOF) done = true;
		if (done) break;

		char res = 0;
		rep(i, 8) rep(j, 8) {
			if (m[i][j] == '1') {
				if (j < 5 && m[i][j+1]=='1'&&m[i][j+2]=='1'&&m[i][j+3]=='1') {
					res = 'C';
				}
				else if (j < 7 && i < 7 && m[i][j+1]=='1'&&m[i+1][j]=='1'&&m[i+1][j+1]=='1') {
					res = 'A';
				}
				else if (i < 5 && m[i+1][j]=='1'&&m[i+2][j]=='1'&&m[i+3][j]=='1') {
					res = 'B';
				}
				else if (i < 6 && j > 0 && m[i+1][j-1]=='1'&&m[i+1][j]=='1'&&m[i+2][j-1]=='1') {
					res = 'D';
				}
				else if (i < 7 && j < 6 && m[i][j+1]=='1'&&m[i+1][j+1]=='1'&&m[i+1][j+2]=='1') {
					res = 'E';
				}
				else if (i < 6 && j < 7 && m[i+1][j+1]=='1'&&m[i+1][j]=='1'&&m[i+2][j+1]=='1') {
					res = 'F';
				}
				else if (i < 7 && j < 7 && j > 0 && m[i][j+1]=='1'&&m[i+1][j]=='1'&&m[i+1][j-1]=='1') {
					res = 'G';
				}
			}
			if (res > 0) goto BREAK;
		}
BREAK:
		printf("%c\n", res);
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
  
#define rep(i,n) for(int i=0;i<int(n);++i)
  
static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
static const double eps = 1e-8;


string s[10];
int sq[10][10]={0};
int x,y;

int solve(){
	if(sq[x][y+1]==1&&sq[x+1][y]==1&&sq[x+1][y+1]==1) return 1;
	else if(sq[x+3][y]==1) return 2;
	else if(sq[x][y+3]==1) return 3;
	else if(sq[x+2][y-1]==1) return 4;
	else if(sq[x+1][y+2]==1) return 5;
	else if(sq[x+2][y+1]==1) return 6;
	else if(sq[x+1][y-1]==1) return 7;
}


int main(){
	
	while(cin>>s[0]){
		x = y = -1;
		
		rep(i,7){
			cin>>s[i+1];
		}
		rep(i,8){
			rep(j,8){
				if(s[i][j]=='0') sq[i+1][j+1]=0;
				else sq[i+1][j+1]=1;
			}
		}
 		
		rep(i,8){
			bool f=false;
			rep(j,8){
				//cout<<i+1<<" "<<j+1<<" "<<sq[i+1][j+1]<<endl;
				if(sq[i+1][j+1]==1){
					x=i+1;
					y=j+1;
					f=true;
					break;
				}
			}
			if(f) break;
		}
					
		//cout<<"x,y= "<<x<<" "<<y<<endl;
		/*
		rep(i,8){
			rep(j,8){
				cout<<sq[i+1][j+1];
			}
			cout<<endl;
		}
		cout<<endl;
		*/
		switch (solve()){
			case 1: cout<<"A\n";
					break;
			case 2: cout<<"B\n";
					break;
			case 3: cout<<"C\n";
					break;
			case 4: cout<<"D\n";
					break;
			case 5: cout<<"E\n";
					break;
			case 6: cout<<"F\n";
					break;
			case 7: cout<<"G\n";
					break;
		default: cout<<"error\n";
			break;
		}
		rep(i,10){
			rep(j,10){
				sq[i][j]=0;
			}
		}
	}
	//while(cin>>t) cout<<t<<endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
    char b[8][8];
    int a[8][8];
	char en;
int main(void){



    while(cin>>b[0]){
        cin>>b[1]>>b[2]>>b[3]>>b[4]>>b[5]>>b[6]>>b[7];


	for(int n=0;n<8;n++){
        for(int m=0;m<8;m++){
            if(b[n][m]=='1')a[n][m]=1;
            else a[n][m]=0;
        }
	}
	int i,j;
	int flag=0;
	char t;
	for(i=0;i<8;i++){
        for(j=0;j<8;j++){
            if(a[i][j]==1){
             //   cout<<i<<j;
                flag=1;
                break;
            }
        }
        if(flag==1)break;
	}
	if(a[i][j]==a[i][j+1]){
	    //cout<<".";
        if(a[i][j+1]==a[i][j+2])t='C';
        else if(a[i][j+1]==a[i+1][j]){
            if(a[i+1][j]==a[i+1][j+1])t='A';
            else if(a[i+1][j]==a[i+1][j-1])t='G';
        }
        else if(a[i][j+1]==a[i+1][j+2])t='E';
	}
    else if(a[i][j]==a[i+1][j]){
        if(a[i+1][j]==a[i+2][j])t='B';
        else if(a[i+1][j]==a[i+1][j+1])t='F';
        else if(a[i+1][j]==a[i+1][j-1])t='D';
    }
    //else cout<<".....";

    cout<<t<<endl;


    }

	return 0;
}

C++: #include <iostream>
using namespace std;
char ma[8][8];

void c(int x,int y){

  if(ma[y+3][x] == '1' && y+3 < 8 )cout << 'B'<<endl;
  else if(ma[y][x+3] == '1' && x+3 < 8)cout << 'C' << endl;
  else if(ma[y+2][x-1] == '1' && y+2 < 8 && x-1 >= 0)cout << 'D' << endl;
  else if(ma[y+1][x+2] == '1' && y+1 < 8 && x+2 < 8)cout << 'E' << endl;
  else if(ma[y+2][x+2] == '1' && y+2 < 8 && x+2 < 8)cout << 'F' << endl;
  else if(ma[y][x+1] == '1' && ma[y+1][x-1] == '1' &&
	  x+1 < 8 && x-1 >= 0 && y+1 < 8)cout << 'G' << endl;
  else cout << 'A' <<endl;

}

int main(){

  while(cin >> ma[0][0]){

    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(i + j == 0)continue;
	cin >> ma[i][j]; 
      }
    }

    int f = 0;
    for(int i = 0 ; i < 8 ; i++ ){
      for(int j = 0 ; j < 8 ; j++ ){
	if(ma[i][j] == '1'){
	  c(j,i);
	  f = 1;
	}
	if(f)break;
      }
    if(f)break;    
    }
  }
  return 0;
}

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

using namespace std;

char ret;

int main()
{

	while(cin){
	string s;
	
	for(int i=0;i<8;i++){
		string s_tmp;
		cin >>s_tmp;
		s += s_tmp;
	}
	// 2次元配列を1次元的に処理
	for(int i=0;i<8*8;i++){
		if(s[i]=='1'){
			// Aかどうか
			if(s[i+1]=='1' && s[i+8]=='1' && s[i+9]=='1'){
				ret = 'A';
				break;
			}else if(s[i+8]=='1' && s[i+16]=='1' && s[i+24]=='1'){
				ret = 'B';
				break;
			}else if(s[i+1]=='1' && s[i+2]=='1' && s[i+3]=='1'){
				ret = 'C';
				break;
			}else if(s[i+7]=='1' && s[i+8]=='1' && s[i+15]=='1'){
				ret = 'D';
				break;
			}else if(s[i+1]=='1' && s[i+9]=='1' && s[i+10]=='1'){
				ret = 'E';
				break;
			}else if(s[i+8]=='1' && s[i+9]=='1' && s[i+17]=='1'){
				ret = 'F';
				break;
			}else if(s[i+1]=='1' && s[i+7]=='1' && s[i+8]=='1'){
				ret = 'G';
				break;
			}
		}
	}
	
	cout<<ret<<endl;
	}
	return 0;
}