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
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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)
	}
}

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

#define SIZE 8

int main() {
	string source[SIZE];
	while (!cin.eof()) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		int map[14][14], x = SIZE, y = SIZE;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = source[i][j] == '1' ? 1 : 0;
				if (source[i][j] == '1' && j < x && i < y) {
					x = j;
					y = i;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] == 1) {
			if (map[y][x + 1] == 1 && map[y + 1][x] == 1) {
				cout << "A";
			} else if (map[y + 2][x + 1] == 1) {
				cout << "F";
			} else if (map[y + 1][x + 2] == 1) {
				cout << "E";
			}
		} else if (map[y - 1][x - 1] == 1) {
			if (map[y][x + 1] == 1) {
				cout << "G";
			} else if (map[y + 2][x - 1] == 1) {
				cout << "D";
			}
		} else if (map[y + 3][x] == 1) {
			cout << "B";
		} else if (map[y][x + 3]) {
			cout << "C";
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
  int block[5][4];
  int sx,sy;
  int x,y;
  string line;
  while(true){
    for(int i=0;i<20;i++)block[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;}
	  block[x-sx][y-sy] = 1;
	}
      }
    }
    if (y<8)break;
    if(block[2][0]&&block[1][1]&&block[2][1])cout<<"A"<<endl;
    if(block[1][3])cout<<"B"<<endl;
    if(block[4][0])cout<<"C"<<endl;
    if(block[0][2])cout<<"D"<<endl;
    if(block[3][1])cout<<"E"<<endl;
    if(block[2][2])cout<<"F"<<endl;
    if(block[0][1]&&block[2][0])cout<<"G"<<endl;
  }
  return 0;
}

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

int main(){
	char f[9][9];
	while(1){
		bool flag=false;
		
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				if( scanf(" %c", &f[i][j])==EOF){
					flag=true;
					break;
				}
			} 
			if(flag) break;	
		}
		if(flag) break;

		bool ans=false;
		char c='1';
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				
				if(f[j][i]==c){
					if(i<=6 && j<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j+1][i+1]==c){
						printf("A\n");	
						ans=true;
						break;
					}
					else if(j<=4 && f[j+1][i]==c && f[j+2][i]==c && f[j+3][i]==c){
						printf("B\n");	
						ans=true;
						break;
					}
					else if(i<=4 && f[j][i+1]==c && f[j][i+2]==c && f[j][i+3]==c){
						printf("C\n");	
						ans=true;
						break;
					}
					else if(1<=j && j<=6 && i<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j-1][i+1]==c){
						printf("D\n");	
						ans=true;
						break;
					}
					else if(j<=5 && i<=6 && f[j][i+1]==c && f[j+1][i+1]==c && f[j+1][i+2]==c){
						printf("E\n");	
						ans=true;
						break;
					}
					else if(j<=6 && i<=5 && f[j+1][i]==c && f[j+1][i+1]==c && f[j+1][i+2]==c){
						printf("F\n");	
						ans=true;
						break;
					}
					else if(1<=j && i<=5 && f[j][i+1]==c && f[j-1][i+1]==c && f[j-1][i+2]==c){
						printf("G\n");	
						ans=true;
						break;
					}
											
				}
	
			}
			if(ans) break;
		}
			
	}
}

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

using namespace std;

int main(void)
{
    char data[12][12];

    while (cin >> data[0]) {
        for (int i = 1; i < 8; i++) {
            cin >> data[i];
        }
        getchar();

        bool fl = false;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (data[i][j] == '1') {
                    if (data[i][j+1] == '1' &&
                            data[i+1][j+1] == '1' &&
                            data[i+1][j] == '1') {
                        puts("A");
                        fl = true;
                    } else if (data[i+1][j] == '1' &&
                            data[i+2][j] == '1' &&
                            data[i+3][j] == '1' ) {
                        puts("B");
                        fl = true;
                    } else if (data[i][j+1] == '1' && 
                            data[i][j+2] == '1' &&
                            data[i][j+3] == '1') {
                        puts("C");
                        fl = true;
                    } else if (data[i+1][j] == '1' && 
                            data[i+1][j-1] == '1' &&
                            data[i+2][j-1] == '1') {
                        puts("D");
                        fl = true;
                    } else if (data[i][j+1] == '1' && 
                            data[i+1][j+1] == '1' &&
                            data[i+1][j+2] == '1') {
                        puts("E");
                        fl = true;
                    } else if (data[i+1][j] == '1' && 
                            data[i+1][j+1] == '1' &&
                            data[i+2][j+1] == '1') {
                        puts("F");
                        fl = true;
                    } else if (data[i+1][j] == '1' && 
                            data[i][j+1] == '1' &&
                            data[i+1][j-1] == '1') {
                        puts("G");
                        fl = true;
                    }
                }
                if (fl) {
                    break;
                }
            }
            if (fl) {
                break;
            }
        }
    }

    return 0;
}