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 main(){
	string line[8];

	while(){


		int w = 0, h = 0, t=-1;

		for(int i=0;i<8;++i)
			cin >> line[i];

		int right=0,left=7;

		for(int i=0;i<8;++i){
			bool exist = false;
			for(int j=0;j<8;++j){
				if((line[i])[j] == '1'){
					if(t!=-1)t=i;
					if(j>right)right = j;
					if(j<left)left = j;
					exist = true;
				}
			}
			if(exist)++h;
		}
		w = right - left + 1;

		if( w == 2 && h == 2 )cout<<"A"<<endl;
		else if(w == 1)cout<<"B"<<endl;
		else if(h == 1)cout<<"C"<<endl;


		else if(w==2){
			for(int i=0;i<8;++i){
				if((line[i])[left] == '1'){
					if((line[i])[left+1]=='1')
						cout<<"D"<<endl;
					else
						cout<<"F"<<endl;
					break;
				}
			}
		}

		else if(h==2){
			for(int i=0;i<8;++i){
				if((line[t])[i]=='1'){
					if((line[t+1])[i]=='1')
						cout<<"G"<<endl;
					else
						cout<<"E"<<endl;
				}
			}
		}

	}
	return 0;
}

C++: #include<stdio.h>

int main()
{
	int a[8][8];
	while(scanf("%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d"
		,&a[0][0],&a[0][1],&a[0][2],&a[0][3],&a[0][4],&a[0][5],&a[0][6],&a[0][7]
	,&a[1][0],&a[1][1],&a[1][2],&a[1][3],&a[1][4],&a[1][5],&a[1][6],&a[1][7]
	,&a[2][0],&a[2][1],&a[2][2],&a[2][3],&a[2][4],&a[2][5],&a[2][6],&a[2][7]
	,&a[3][0],&a[3][1],&a[3][2],&a[3][3],&a[3][4],&a[3][5],&a[3][6],&a[3][7]
	,&a[4][0],&a[4][1],&a[4][2],&a[4][3],&a[4][4],&a[4][5],&a[4][6],&a[4][7]
	,&a[5][0],&a[5][1],&a[5][2],&a[5][3],&a[5][4],&a[5][5],&a[5][6],&a[5][7]
	,&a[6][0],&a[6][1],&a[6][2],&a[6][3],&a[6][4],&a[6][5],&a[6][6],&a[6][7]
	,&a[7][0],&a[7][1],&a[7][2],&a[7][3],&a[7][4],&a[7][5],&a[7][6],&a[7][7])!=EOF)
	{
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				if(a[x][y]==1)
				{
					if(a[x][y+1]==1)
					{
						if(a[x+1][y]==1)
						{
							if(a[x+1][y+1])
							{						
								printf("A\n");
							}
							else if(a[x+1][y-1])
							{
								printf("G\n");
							}
						}
						else if(a[x][y+2]==1&&a[x][y+3]==1)
						{
							printf("C\n");
						}
						else if(a[x+1][y+1]==1&&a[x+1][y+2]==1)
						{
							printf("E\n");
						}
					}
					else if(a[x+1][y]==1)
					{
						if(a[x+2][y]==1&&a[x+3][y]==1)
						{
							printf("B\n");
						}
						else if(a[x+1][y-1]==1&&a[x+2][y-1]==1)
						{
							printf("D\n");
						}
						else if(a[x+1][y+1]==1&&a[x+2][y+1]==1)
						{
							printf("F\n");
						}
					}
					x=10;
					y=10;
				}
			}
		}
	}
return 0;
}

C++: import java.util.Scanner;

public class Main {

	static Scanner sc = new java.util.Scanner(System.in);

	// static int[][] num =new int [8][8];

	public static void main(String[] args) {

		int[][] num = new int[15][15];
		String str = "";

		while (sc.hasNextLine()) {
			// num[][]????????????
			syokika(num);
			// ???????????¨????????????????´?
			for (int i = 0; i < 8; i++) {
				str = sc.next();
				String[] st = str.split("");
				for (int j = 0; j < 8; j++) {
					num[i][j] = Integer.parseInt(st[j]);
				}
			}
			// ????????????
			for (int i = 0; i < 8; i++) {
				for (int j = 0; j < 8; j++) {
					if(num[i][j]==1&&num[i][j+1]==1&&num[i+1][j]==1&&num[i+1][j+1]==1){
						System.out.println("A");
					}else if(num[i][j]==1&&num[i+1][j]==1&&num[i+2][j]==1&&num[i+3][j]==1){
						System.out.println("B");
					}else if(num[i][j]==1&&num[i][j+1]==1&&num[i][j+2]==1&&num[i][j+3]==1){
						System.out.println("C");
					}else if(num[i][j+1]==1&&num[i+1][j]==1&&num[i][j+1]==1&&num[i+2][j]==1){
						System.out.println("D");
					}else if(num[i][j]==1&&num[i][j+1]==1&&num[i+1][j+1]==1&&num[i+1][j+2]==1){
						System.out.println("E");
					}else if(num[i][j]==1&&num[i+1][j]==1&&num[i+1][j+1]==1&&num[i+2][j+1]==1){
						System.out.println("F");
					}else if(num[i][j+1]==1&&num[i][j+2]==1&&num[i+1][j]==1&&num[i+1][j+1]==1){
						System.out.println("B");
					}

				}
			}

		}

	}
}

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

using namespace std;

int main(void){
    int n,i=0,count=0;
    while (cin>>n) {
        if (n==1) count++;
        if(n==1 || 0<i){
            i++;
        }
        
        if(i==4&&count==4){
            cout<<"C"<<endl;
            i=0,count=0;
        }
        else if (i==10&&count==4){
            cout<<"A"<<endl;
            i=0,count=0;
        }
        else if (i==25&&count==4){
            cout<<"B"<<endl;
            i=0,count=0;
        }
        else if (i==16&&count==4){
            cout<<"D"<<endl;
            i=0,count=0;
        }
        else if (i==11&&count==4){
            cout<<"E"<<endl;
            i=0,count=0;
        }
        else if (i==18&&count==4){
            cout<<"F"<<endl;
            i=0,count=0;
        }
        else if (i==9&&count==4){
            cout<<"G"<<endl;
            i=0,count=0;
        }
    }
    
    return 0;
}