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 <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]);
		}
		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("F\n");
						FLG = true;
						break;
					}
				}
			}
			if(FLG)break;
		}
	}


	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
     char field[8][8];
     char tmp;
     int i,j;
	 while(1){
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   cin >> field[i][j];
		   //cout << field[i][j];
		 }
		 //cout << endl;
	   }
	   
	   //»ê¼êÌ`ÉÂ¢Ä»Ê
	   //Ü¸¶ãÌ}XðT·
	   for(i=0;i<8;i++){
		 for(j=0;j<8;j++){
		   if(field[i][j] == '1') goto NEXT;
		 }
	   }
	 NEXT:
	   //cout << i << "    " << j << endl;

     
	   if(j+3 <= 7 && field[i][j+1] == '1' && field[i][j+2] == '1' && field[i][j+3] == '1'){
		 //¡êñ
		 cout << "C" << endl;
	   }else if(i+3 <= 7 && field[i+1][j]  == '1' && field[i+2][j] == '1' && field[i+3][j] == '1'){
		 //cêñ
		 cout << "B" << endl;
	   }else if(j+1 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j] == '1' && field[i+1][j+1] == '1'){
		 //³û`
		 cout << "A" << endl;
	   }else if(i+2 <= 7 && j+1 <= 7 && field[i+1][j] == '1' && field[i+1][j+1]  == '1' && field[i+2][j+1] == '1'){
		 //1 0
		 //1 1
		 //0 1
		 cout << "F" << endl;
	   }else if(j-1 >= 0 && j+1 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j] == '1' && field[i+1][j-1] == '1'){
		 //0 1 1
		 //1 1 0
		 cout << "G" << endl;
	   }else if(j+2 <= 7 && i+1 <= 7 && field[i][j+1] == '1' && field[i+1][j+1]  == '1' && field[i+1][j+2] == '1'){
		 //1 1 0
		 //0 1 1
		 cout << "E" << endl;
	   }else{
		 cout << "D" << endl;
	   }
	   cin.ignore();
	   cin.ignore();
	   if(cin.eof()) return 0;
	 }
	 return 0;
}

C++: #include <iostream>
main(){int b[5][4],s,t,x,y;char l[8];for(;;){for(int i=0;i<20;i++)b[i%5][i/5]=0;sx=sy=9;for(y=0;y<8;y++){if(!(std::cin>>l))break;for(x=0;x<8;x++){if(l[x]=='1'){if(t==9){s=x-1;t=y;}b[x-s][y-t]=1;}}}if (y<8)break;char 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';std::cout<<a<<"\n";}}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    enum blocks{
        A = 18, B = 48, C = 6, D = 30, E = 20, F = 34, G = 16
    };
    string surface, input;
    while(cin >> surface){
        rep(i,7){
            cin >> input;
            surface+= input;
        }
        int first = -1, location = 0;
        rep(i,65){
            if(surface[i] == '1' && first == -1){
                first = i;
            }else if(surface[i] == '1'){
                location+= i - first;
            }
        }
        if(A == location) cout << 'A' << endl;
        else if(B == location) cout << 'B' << endl;
        else if(C == location) cout << 'C' << endl;
        else if(D == location) cout << 'D' << endl;
        else if(E == location) cout << 'E' << endl;
        else if(F == location) cout << 'F' << endl;
        else if(G == location) cout << 'G' << endl;
    }
}

C++: #include<stdio.h>
#include<string.h>
#include<stdlib.h>

void figure(char a[8][8])
{
  int i,j;
  for(i=0;i<8;i++)
    for(j=0;j<8;j++)
      if(a[i][j]=='1'){
	if(a[i][j+1]=='1'){
	  if(a[i+1][j]=='1' && a[i+1][j+1]=='1')
	    printf("A\n");
	  else if(a[i][j+2]=='1' && a[i][j+3]=='1')
	    printf("C\n");	
	  else if(a[i+1][j+1]=='1' && a[i+1][j+2]=='1')
	    printf("E\n");
	  else if(a[i+1][j]=='1' && a[i+1][j-1]=='1')
	    printf("G\n");
	}
	else if(a[i+1][j]=='1'){
	  if(a[i+2][j]=='1' && a[i+3][j]=='1')
	    printf("B\n");
	  else if(a[i+1][j-1]=='1' && a[i+2][j-1]=='1')
	    printf("D\n");
	  else if(a[i+1][j+1]=='1' && a[i+2][j+1]=='1')
	    printf("F\n");
	}
	goto OUT;
      }
 OUT:;
}

int main(void)
{
  char a[8][8];
  char *buf;
  int i,j,flag;
  while(1){
    for(i=0;i<8;i++){
      buf=malloc(sizeof(char)*9);
      if(fgets(buf,sizeof(char)*9,stdin)==NULL){
	goto OUT;
      }
      if(flag==1)break;
      // buf[8]='\0';
      for(j=0;j<8;j++)
	a[i][j]=buf[j];
      free(buf);
      //rewind(stdin);//これがないと変になる
    }
    figure(a);
   
  }
 OUT:
  return 0;
}