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>

#define limit(A,X,C) ((X<A)?A:(C<X)?C:X)

char map[8+1][8]={0};

int pget(int x,int y)
{
	if(limit(0,x,7)==x && limit(0,y,7)==y)
		return map[y][x]-'0';
	return 0;
}

char check(int x, int y)
{
	if(pget(x+1,y))
	{
		if(pget(x+2,y))
			return 'C';
		if(!pget(x,y+1))
			return 'E';
		if(pget(x+1,y+1))
			return 'A';
		return 'G';
	}
	if(pget(x,y+2))
		return 'B';
	if(pget(x+1,y+2))
		return 'F';
	return 'D';
}

int main(void)
{
	do
	{
		for(int i=0; i<8; i++)
			std::cin >> map[i];
		int x,y;
		for(int j=0; j<8; j++)
		{
			for(int i=0; i<8; i++)
				if(map[j][i] == '1')
				{
					x=i;
					y=j;
					break;
				}
			if(x && y)
				break;
		}

		std::cout << check(x,y) << std::endl;
	}while(std::cin >> map[0][0]);
	
	return 0;
}

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

int main()
{
  while (true)
  {
    char board[8][8];
    for (int i=0; i<8; i++)
    {
      for (int j=0; j<8; j++)
      {
        cin >> board[i][j];
      }
    }

    bool flag = false;
    for (int i=0; i<8; i++)
    {
      for (int j=0; j<8; j++)
      {
        if ( board[i][j] == '1' )   //  ブロックがあれば
        {
          if ( board[i+3][j] == '1' )
          {
            cout << 'B' << endl;
          }
          else if ( board[i][j+3] == '1' )
          {
            cout << 'C' << endl;
          }
          else if ( board[i+2][j-1] == '1' )
          {
            cout << 'D' << endl;
          }
          else if ( board[i+1][j+2] == '1' )
          {
            cout << 'E' << endl;
          }
          else if ( board[i+2][j+1] == '1' )
          {
            cout << 'F' << endl;
          }
          else if ( board[i+1][j-1] == '1' )
          {
            cout << 'G' << endl;
          }
          else
          {
            cout << 'A' << endl;
          }
          flag = true;
        }
        if (flag) break;
      }
      if (flag) break;
    }

    char dummy;
    cin >> noskipws;
    cin >> dummy;
    cin >> skipws;
    if ( cin.eof() ) break;
  }
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int x[13][13];
int main() {
	while (cin >> x[1][1]) {
		memset(x, 0, sizeof(x));
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				if (i + j > 2) { cin >> x[i][j]; }
			}
		}
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				if (x[i][j] == 1) {
					if (x[i + 1][j] == 1 && x[i][j + 1] == 1 && x[i + 1][j + 1] == 1) {
						cout << 'A' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 2][j] == 1 && x[i + 3][j] == 1) {
						cout << 'B' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i][j + 2] == 1 && x[i][j + 3] == 1) {
						cout << 'C' << endl; goto Exit;
					}
					if (x[i + 1][j - 1] == 1 && x[i + 1][j] == 1 && x[i + 2][j - 1] == 1) {
						cout << 'D' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j + 1] == 1 && x[i + 1][j + 2] == 1) {
						cout << 'E' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 1][j + 1] == 1 && x[i + 2][j + 1] == 1) {
						cout << 'F' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j - 1] == 1 && x[i + 1][j] == 1) {
						cout << 'G' << endl; goto Exit;
					}
				}
			}
		}
	Exit:;
	}
}

C++: #include<iostream>
#include<vector>
#include<stdio.h>
using namespace std;

int main(){
    char boa[8][8];
    while(1){
        
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(!(cin>>boa[i][j]))
                    return 0;
            }
        }
        int bo[8][8];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                bo[i][j]=boa[i][j]-'0';
            }
        }
            
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(bo[i][j]==1){
                    if(i<8&&j<8){
                        if(bo[i+1][j]==1&&bo[i][j+1]==1&&bo[i+1][j+1]){
                            cout<<"A"<<endl;
                            goto next;
                        }
                    }
                    if(j<4){
                        if(bo[i][j+1]&&bo[i][j+2]&&bo[j+3]){
                            cout<<"C"<<endl;goto next;
                        }
                            
                    }
                    if(i<4){
                        if(bo[i+1][j]&&bo[i+2][j]&&bo[i+3][j]){
                            cout<<"B"<<endl;goto next;
                        }
                        
                    }
                    if(i<7&&i>0&&j<7){
                        if(bo[i+1][j]&&bo[i][j+1]&&bo[i-1][j+1]){
                            cout<<"D"<<endl;goto next;
                        }
                    }
                    if(i<7&&j<6){
                        if(bo[i][j+1]&&bo[i+1][j+1]&&bo[i+1][j+2]){
                            cout<<"E"<<endl;goto next;
                        }
                    }
                    if(i<6&&j<7){
                        if(bo[i+1][j]&&bo[i+1][j+1]&&bo[i+2][j+1]){
                            cout<<"F"<<endl;goto next;
                        }
                    }
                    if(i<6&&j>0){
                        if(bo[i+1][j]&&bo[i+1][j-1]&&bo[i][j+1]){
                            cout<<"G"<<endl;goto next;
                        }
                    }
                    
                }
            }
        }
        
    next:;
    }
    
    return 0;
}