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 <vector>
#include <string>

using namespace std;

void solve()
{
	string str;
	while(cin >> str)
	{
		char field[11][12];
		for(int i = 0; i < 11; ++i)
		{
			for(int j = 0; j < 12; ++j)
			{
				field[i][j] = '0';
			}
		}
		for(int i = 0; i < str.size(); ++i)
		{
			field[0][i + 1] = str[i];
		}
		for(int i = 0; i < 7; ++i)
		{
			cin >> str;
			for(int j = 0; j < str.size(); ++j)
			{
				field[i + 1][j + 1] = str[j];
			}
		}
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				if(field[i][j] == '1')
				{
					if(field[i][j + 1] == '1' && field[i + 1][j] == '1' && field[i + 1][j + 1] == '1')
					{
						cout << "A" << endl;
					}
					if(field[i + 1][j] == '1' && field[i + 2][j] == '1' && field[i + 3][j] == '1')
					{
						cout << "B" << endl;
					}
					if(field[i][j + 1] == '1' && field[i][j + 2] == '1' && field[i][j + 3] == '1')
					{
						cout << "C" << endl;
					}
					if(field[i + 1][j - 1] == '1' && field[i + 1][j] == '1' && field[i + 2][j - 1] == '1')
					{
						cout << "D" << endl;
					}
					if(field[i][j + 1] == '1' && field[i + 1][j + 1] == '1' && field[i + 1][j + 2] == '1')
					{
						cout << "E" << endl;
					}
					if(field[i + 1][j] == '1' && field[i + 1][j + 1] == '1' && field[i + 2][j + 1] == '1')
					{
						cout << "F" << endl;
					}
					if(field[i + 1][j - 1] == '1' && field[i + 1][j] == '1' && field[i][j + 1] == '1')
					{
						cout << "G" << endl;
					}
				}
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){
	int ax, ay;
	char f[12][12];
	bool flag = false;

	for(int y=0 ; y<12 ; y++){
		for(int x=0 ; x<12 ; x++){
			f[y][x] = 0;
		}
	}

	while( 1 ){
		for(int i=0 ; i<8 ; i++) {
			if( scanf("%s", f[i]) == EOF ){
				flag = true;
				break;
			}
		}
		if(flag) break;

		for(int i=0 ; i<64 ; i++){
			if(f[i/8][i%8]=='1'){
				ax = i%8;
				ay = i/8;
				break;
			}
		}
		if( f[ay+1][ax]=='1' && f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' ){
			printf("A\n");
		}else if( f[ay+1][ax]=='1' && f[ay+2][ax]=='1' && f[ay+3][ax]=='1' ){
			printf("B\n");
		}else if( f[ay][ax+1]=='1' && f[ay][ax+2]=='1' && f[ay][ax+3]=='1' ){
			printf("C\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' && f[ay+1][ax+2]=='1' ){
			printf("E\n");
		}else if( f[ay+1][ax]=='1' && f[ay+1][ax+1]=='1' && f[ay+2][ax+1]=='1' ){
			printf("F\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("G\n");
		}else if( f[ay+2][ax-1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("D\n");
		}
	}
}

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

using namespace std;

char ret;

int main()
{

	string s;
	while(cin>>s){
	
	
	for(int i=1;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;
}

C++: #include <iostream>
#include <string>
using namespace std;int main(){int b[5][4];int sx,sy;int x,y;string line;while(true){for(int i=0;i<20;i++)b[i%5][i/5]=0;sx=sy=-1;for(y=0;y<8;y++){if (!(cin>>line))break;for(x=0;x<8;x++){if (line[x]=='1'){if (sy==-1){sx=x-1;sy=y;}b[x-sx][y-sy] = 1;}}}if (y<8)break;char a;if(b[2][0]&&b[1][1]&&b[2][1])a='A';if(b[1][3])a='B';if(b[4][0])a="C";if(b[0][2])a="D";if(b[3][1])a="E";if(b[2][2])a="F";if(b[0][1]&&b[2][0])a="G";cout<<a<<endl;}}

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

int main(void){
	string s[8];
	while(cin>>s[0]){
		std::vector<pair<int,int> > v;
		for(int i=1;i<8;i++)cin>>s[i];
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(s[i][j]=='1')v.push_back(make_pair(i,j));
			}
		}
		// second=x,first=y
		if(v[0].first==v[1].first&&v[0].second==v[2].second)cout<<"A"<<endl;
		else if(v[0].second==v[1].second&&v[2].second==v[1].second&&v[2].second==v[3].second)cout<<"B"<<endl;
		else if(v[2].first==v[0].first)cout<<"C"<<endl;
		else if(make_pair(v[0].first+2,v[0].second-1)==v[3])cout<<"D"<<endl;
		else if(make_pair(v[0].first+1,v[0].second+2)==v[3])cout<<"E"<<endl;
		else if(make_pair(v[0].first+2,v[0].second+1)==v[3])cout<<"F"<<endl;
		else cout<<"G"<<endl;
		// cin>>s[0]; // CRLF
	}
}