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

using namespace std;

char checkData( array< int, 4 > data_i, array< int, 4 > data_j )
{
        int i = 0, j = 0;
        if (
                        data_i[i] + 1 == data_i[i+1] &&
                        data_j[j] == data_j[j+1] &&
                        data_i[i] == data_i[i+2] &&
                        data_j[j] + 1 == data_j[i+2] &&
                        data_i[i] + 1 == data_i[j+3] &&
                        data_j[j] + 1 == data_j[j+3]
           )
        {
                return 'A';
        }
        else if (
                        data_i[i] == data_i[i+1] &&
                        data_j[j] + 1 == data_j[j+1] &&
                        data_i[i] == data_i[i+2] &&
                        data_j[j] + 2 == data_j[j+2] &&
                        data_i[i] == data_i[i+3] &&
                        data_j[j] + 3 == data_j[j+3]
        )
        {
                return 'B';
        }
        else if (
                        data_i[i] + 1 == data_i[i+1] &&
                        data_j[j] == data_j[j+1] &&
                        data_i[i] + 2 == data_i[i+2] &&
                        data_j[j] == data_j[j+2] &&
                        data_i[i] + 3 == data_i[j+3] &&
                        data_j[j] == data_j[j+3]
        )
        {
                return 'C';
        }
        else if (
                        data_i[i] - 1 == data_i[i+1] &&
                        data_j[j] + 1 == data_j[j+1] &&
                        data_i[i] == data_i[i+2] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] - 1 == data_i[i+3] &&
                        data_j[j] + 2 == data_j[j+3]
        )
        {
                return 'D';
        }
        else if (
                        data_i[i] + 1 == data_i[i+1] &&
                        data_j[j] == data_j[j+1] &&
                        data_i[i] + 1 == data_i[i+2] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] + 2 == data_i[i+3] &&
                        data_j[j] + 1 == data_j[j+3]
        )
        {
                return 'E';
        }
        else if (
                        data_i[i] == data_i[i+1] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] + 1 == data_i[i+2] &&
                        data_j[j] + 1 == data_j[j+2] &&
                        data_i[i] + 1 == data_i[i+2] &&
                        data_j[j] + 2 == data_j[j+3]
        )
        {
                return 'F';
        }
        else
        {
                return 'G';
        }


}


int main()
{
        char table[8][8];
        array< int, 4 > data_i;
        array< int, 4 > data_j;
        int tmp = 0, inum = 0, jnum = 0, i, j;

        while ( cin >> table[0] )
        {
                for ( i = 1 ; i < 8 ; i++ )
                {
                        cin >> table[i];
                }
                for ( i = 0 ; i < 8 ; i++ )
                {
                        for ( j = 0 ; j < 8 ; j++ )
                        {
                                if ( table[i][j] == '1' )
                                {
                                        data_i[inum] = i;
                                        data_j[jnum] = j;
                                        inum++;
                                        jnum++;
                                }
                        }
                }
                inum = 0;
                jnum = 0;
                cout << checkData( data_j, data_i ) << endl;
        }
        return 0;
}

C++: #include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	char table[8][9];

	while(scanf("%s",table[0])!=EOF){
		for(int i=1;i<8;i++){
			scanf("%s",table[i]);
		}
		getchar();
		bool FLG = false;
		for(int i=0; i < 8; i++){
			for(int k=0; k<8; k++){
				if(table[i][k] == '1'){
					if(i <= 6 && k <= 6 && table[i][k+1] == '1' && table[i+1][k] == '1' && table[i+1][k+1] == '1'){
						printf("A\n");
						FLG = true;
						break;
					}else if(i <= 4 && table[i+1][k] == '1' && table[i+2][k] == '1' && table[i+3][k] == '1'){
						printf("B\n");
						FLG = true;
						break;
					}else if(k <= 4 && table[i][k+1] == '1' && table[i][k+2] == '1' && table[i][k+3] == '1'){
						printf("C\n");
						FLG = true;
						break;
					}else if(i <= 5 && k >= 1 && table[i+1][k-1] == '1' && table[i+1][k] == '1' &&
							table[i+2][k-1] == '1'){
						printf("D\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 5 && table[i][k+1] == '1' && table[i+1][k+1] == '1' &&
							table[i+1][k+2] == '1'){
						printf("E\n");
						FLG = true;
						break;
					}else if(i <= 5 && k <= 6 && table[i+1][k] == '1' && table[i+1][k+1] == '1' &&
							table[i+2][k+1] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 6 && k >= 1 && table[i][k+1] == '1' && table[i+1][k-1] == '1' &&
							table[i+i][k] == '1'){
						printf("G\n");
						FLG = true;
						break;
					}
				}
			}
			if(FLG)break;
		}

	}


	return 0;
}