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

using namespace std;

int field[8][8], first[2];

void searchFirstPlace();
int sumLine(int _line);

int main() {
	int sum;
	string str;
	char ans;

	while (1) {
		/*??\???*/
		for (int i = 0; i < 8; i++) {
			cin >> str;
			if (cin.eof()) break;

			for (int j = 0; j < 8; j++)
				field[i][j] = (str[j] == '1') ? 1 : 0;
		}
		if (cin.eof()) break;

		/*??????*/
		searchFirstPlace();
		sum = sumLine(first[1]);

		if (sum == 4) {
			ans = 'C';
		}
		else if (sum == 1) {
			if (sumLine(first[1] + 1) == 1)
				ans = 'B';
			else if (field[first[1] + 2][first[0] + 1] == 1)
				ans = 'F';
			else
				ans = 'D';
		}
		else {
			if (field[first[1] + 1][first[0]] == 0)
				ans = 'E';
			else if (field[first[1] + 1][first[0] + 1] == 0)
				ans = 'G';
			else
				ans = 'A';
		}

		/*??????*/
		cout << ans << endl;
	}

	return 0;
}

/*?????????????????¢??????1??????????????£?????????????????§?¨??????????*/
void searchFirstPlace() {
	bool flag = false;

	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			if (field[i][j] == 1) {
				first[0] = j;
				first[1] = i;

				flag = true;
				break;
			}
		}
		if (flag) break;
	}
}

/*???????????°??¨??????????????????????????°?????????*/
int sumLine(int _line) {
	int ans = 0;

	for (int i = 0; i < 8; i++) {
		if (field[_line][i] == 1) {
			ans++;
		}
	}

	return ans;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int field[20][20]={0};
  for(;;){
    if(scanf("%1d",&field[5][5]) == EOF) break;
    for(int i=0; i<8; i++)
      for(int j=0; j<8; j++)
	if(i!=0 || j!=0) scanf("%1d",&field[i+5][j+5]);
    for(int i=0; i<8; i++){
      for(int j=0; j<8; j++){
	if(field[i+5][j+5] == 1 && field[i+6][j+5] == 1 && field[i+6][j+6] == 1 && field[i+5][j+6] == 1){cout <<"A"<<endl; goto flag;}
	if(field[i+5][j+5] == 1 && field[i+6][j+5] == 1 && field[i+7][j+5] == 1 && field[i+8][j+5] == 1){cout <<"B"<<endl; goto flag;}
	if(field[i+5][j+5] == 1 && field[i+5][j+6] == 1 && field[i+5][j+7] == 1 && field[i+5][j+8] == 1){cout <<"C"<<endl; goto flag;}
	if(field[i+5][j+5] == 1 && field[i+6][j+5] == 1 && field[i+6][j+4] == 1 && field[i+7][j+4] == 1){cout <<"D"<<endl; goto flag;}
	if(field[i+5][j+5] == 1 && field[i+5][j+6] == 1 && field[i+6][j+6] == 1 && field[i+6][j+7] == 1){cout <<"E"<<endl; goto flag;}
	if(field[i+5][j+5] == 1 && field[i+6][j+5] == 1 && field[i+6][j+6] == 1 && field[i+7][j+6] == 1){cout <<"F"<<endl; goto flag;}
	if(field[i+5][j+5] == 1 && field[i+5][j+6] == 1 && field[i+6][j+5] == 1 && field[i+6][j+4] == 1){cout <<"G"<<endl; goto flag;}
      }
    }
  flag:;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
     char field[8][8];
     char tmp;
     int i,j;
	 while(1){
	   if(cin.eof()) return 0;
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   cin >> field[i][j];
		   //cout << field[i][j];
		 }
		 //cout << endl;
	   }
	   
	   //»ê¼êÌ`ÉÂ¢Ä»Ê
	   //Ü¸¶ãÌ}XðT·
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   if(field[i][j] == '1') goto NEXT;
		 }
	   }
	 NEXT:
	   //cout << i << "    " << j << endl;

     
	   if(j+3 <= 7 && field[i][j+1] == '1' && field[i][j+2] == '1' && field[i][j+3] == '1'){
		 //¡êñ
		 cout << "C" << endl;
	   }else if(i+3 <= 7 && field[i+1][j]  == '1' && field[i+2][j] == '1' && field[i+3][j] == '1'){
		 //cêñ
		 cout << "B" << endl;
	   }else if(j+1 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j] == '1' && field[i+1][j+1] == '1'){
		 //³û`
		 cout << "A" << endl;
	   }else if(i+2 <= 7 && j+1 <= 7 && field[i+1][j] == '1' && field[i+1][j+1]  == '1' && field[i+2][j+1] == '1'){
		 //1 0
		 //1 1
		 //0 1
		 cout << "F" << endl;
	   }else if(j-1 >= 0 && j+1 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j] == '1' && field[i+1][j-1] == '1'){
		 //0 1 1
		 //1 1 0
		 cout << "G" << endl;
	   }else if(j+2 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j+1]  == '1' && field[i+1][j+2] == '1'){
		 //1 1 0
		 //0 1 1
		 cout << "E" << endl;
	   }else{
		 cout << "D" << endl;
	   }
	 }
	 return 0;
}

C++: #include <iostream>

using namespace std;

void solve()
{
	char field[11][12];
	char a;
	while(cin >> a)
	{
		for(int i = 0; i < 11; ++i)
		{
			for(int j = 0; j < 12; ++j)
			{
				field[i][j] = '0';
			}
		}
		field[1][1] = a;
		for(int i = 2; i < 9; ++i)
		{
			cin >> field[1][i];
		}
		for(int i = 2; i < 9; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				cin >> field[i][j];
			}
		}
		for(int i = 1; i < 9; ++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;
					}
					else if(field[i + 1][j] == '1' && field[i + 2][j] == '1' && field[i + 3][j] == '1')
					{
						cout << "B" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i][j + 2] == '1' && field[i][j + 3] == '1')
					{
						cout << "C" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i - 1][j + 1] == '1' && field[i - 1][j + 2] == '1')
					{
						cout << "D" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i + 1][j + 1] == '1' && field[i + 1][j + 2] == '1')
					{
						cout << "E" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i + 1][j + 1] == '1' && field[i + 2][j + 1] == '1')
					{
						cout << "F" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i + 1][j + 1] == '1' && field[i + 1][j - 2] == '1')
					{
						cout << "G" << endl;
					}
				}
			}
		}
	}
}

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