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<cstdio>
#include<cstring>

int main(){
	char p[7][19] = {"1100000011", "10000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011"};
	char f[65];
	char t;
	while(1 + scanf("%c", &t)){
		if(t-10){
			f[0] = t;
		}else{
			scanf("%c", &f[0]);
		}
		for(int i = 1; i < 64; i++){
			scanf("%c", &t);
			if(t - 10){
				f[i] = t;
			}else{
				i--;
			}
		}
		f[64] = '\0';
		for(int i = 0; i < 7; i++){
			if(strstr(f, p[i])){
				printf("%c\n", i + 'A');
			}
		}
	}
	return 0;
}

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

int main(){
	int mass[8][8];
	
	BEGIN:
	while(scanf("%d%d%d%d%d%d%d%d",(*mass[0]),(*mass[0])+1,(*mass[0])+2,(*mass[0])+3,(*mass[0])+4,
		(*mass[0])+5,(*mass[0])+6,(*mass[0])+7)!=EOF)
	{
		for(int i=1;i<8;i++){
			scanf("%d%d%d%d%d%d%d%d",(*mass[i]),(*mass[i]+1),(*mass[i]+2),(*mass[i]+3),(*mass[i]+4),
				(*mass[i]+5),(*mass[i]+6),(*mass[i]+7));
		}
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(mass[i][j]){
					if(j==7){
						if(mass[i+1][j]){
							cout<<(mass[i+1][j-1]?"D\n":"B\n");
						}
					}else if(j==0){
						if(mass[i][j+1]){
							if(mass[i+1][j]) cout<<"A\n";
							else if(mass[i][j+2]) cout<<"C\n";
							else cout<<"E\n";
						}
						else cout<<(mass[i+1][j+1]?"F\n":"B\n");
					}else{
						if(mass[i][j+2]) cout<<"C\n";
						else if(mass[i][j+1]){
							if(mass[i+1][j]){
								cout<<(mass[i+1][j+1]?"A\n":"G\n");
							}
							else cout<<"E\n";
						}
						else if(mass[i+2][j]) cout<<"B\n";
						else cout<<(mass[i+1][j+1]?"F\n":"D\n");
					}
					goto BEGIN;
				}
			}
			return 0;
		}
	}
}

C++: #include <stdio.h>
int main(){
	char c[100][100];
	bool f;
	while(scanf("%s",c[0])!=EOF){
		f=true;
		for(int i=1;i<8;i++)scanf("%s",c[i]);
		for(int i=0;i<8&&f;i++)for(int j=0;j<8&&f;j++){
			if(c[i][j]=='1'){
				f=false;
				if(c[i][j+1]=='1'){
					if(c[i][j+2]=='1')printf("C\n");
					else if(c[i+1][j]=='1'){
						if(c[i+1][j+1]=='1')printf("A\n");
						else printf("G\n");
					}
					else printf("E\n");
				}
				else if(c[i+2][j]=='1')printf("B\n");
				else if(c[i+2][j+1]=='1')printf("F\n");
				else printf("D\n");
			}
		}
	}
}

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

int main(){

  char str[11][11];

  while( scanf("%s",str[0]) != EOF){
    
    int x=-1,y=-1;

    for(int j=0;j<8;j++){
      if(str[0][j]=='1'){
	x=j;
	y=0;
	break;
      }
    }
    
    for(int i=1;i<8;i++){
      scanf("%s",str[i]);
      if(x==-1 && y==-1){
	for(int j=0;j<8;j++){
	  if(str[i][j]=='1'){
	    x=j;
	    y=i;
	    break;
	  }
	}
      }
    }
    
    if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x+1]=='1') printf("A\n");
    else if(str[y+1][x]=='1' && str[y+2][x]=='1' && str[y+3][x]=='1') printf("B\n");
    else if(str[y][x+1]=='1' && str[y][x+2]=='1' && str[y][x+3]=='1') printf("C\n");
    else if(str[y+1][x]=='1' && str[y+1][x-1]=='1' && str[y+2][x-1]=='1') printf("D\n");
    else if(str[y][x+1]=='1' && str[y+1][x+1]=='1' && str[y+1][x+2]=='1') printf("E\n");
    else if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x-1]=='1') printf("F\n");
    else printf("G\n");
    
  }
  return 0;
    
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int sur[8][8];
  int x, y;
  string s;

  while (true) {
    bool isGetted = false;
    for (int i = 0; i < 8; i++) {
      getline(cin, s);
      for (int j = 0; j < 8; j++) {
        if (s[j] == '1' && !isGetted) {
          x = j;
          y = i;
          isGetted = true;
        }
        sur[i][j] = s[j] - '0';
      }
    }

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

    if (!getline(cin, s))
      break;
  }
  return 0;
}