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 < 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 <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i) = 0;(i)<(n);(i)++)
#define pb push_back
#define mp make_pair
#define All(X) X.begin(),X.end()

int main(){
	vector<int> vx, vy;
	while (1){
		REP(i, 8){
			string str;
			cin >> str;
			if (cin.eof()){
				return 0;
			}
			REP(j, 8){
				if (str[j] == '1'){
					vx.pb(i);
					vy.pb(j);
				}
			}
		}
		char ans = 'G';
		if (vx[0] == vx[1] && vy[0] == vy[2]) ans == 'A';
		if (vy[0] == vy[1] && vy[0] == vy[2] && vy[0] == vy[3]) ans = 'B';
		if (vx[0] == vx[1] && vx[0] == vx[2] && vx[0] == vx[3]) ans = 'C';
		if (vx[1] == vx[2] && vy[1] == vy[3] && vy[0] == vy[2]) ans = 'D';
		if (vx[0] == vx[1] && vx[2] == vx[3] && vy[1] == vy[2] && vy[0] + 2 == vy[3]) ans = 'E';
		if (vx[1] == vx[2] && vy[0] == vy[1] && vy[2] == vy[3]) ans = 'F';
		cout << ans << endl;
	}
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;

 char arr[8][8];
 
 int main()
 {
   while(cin>>arr[0][0])
   {
     int x[4],y[4];
     int cnt1,cnt2;
     cnt1=cnt2=0;
     if(arr[0][0]=='1') 
     {
       x[cnt1++]=0;
       y[cnt2++]=0;                   
     }
     for(int i=0;i<8;i++)
     {
       for(int j=0;j<8;j++)
       {
           if(i==0&&j==0) continue;
           else
           {
             cin>>arr[i][j];
             if(arr[i][j]=='1')
             {
               x[cnt1++]=j;
               y[cnt2++]=i;                
             }
           }    
                 
       }        
     }             
     if(y[0]==y[1]&&y[2]==y[3]&&x[1]==x[0]+1&&x[3]==x[2]+1&&y[2]==y[0]+1&&x[3]==x[0]+1) cout<<"A"<<endl;
     else if(x[0]==x[1]&&x[1]==x[2]&&x[2]==x[3]) cout<<"B"<<endl;
     else if(y[0]==y[1]&&y[1]==y[2]&&y[2]==y[3]) cout<<"C"<<endl;
     else if(y[1]==y[2]&&y[3]==y[0]+2) cout<<"D"<<endl;
     else if(x[1]==x[2]&&(x[3]==x[0]+2)) cout<<"E"<<endl;
     else if(y[1]==y[2]&&y[3]==y[0]+2) cout<<"F"<<endl;
     else cout<<"G"<<endl;        
   }
   //while(1);
   return 0;
 }

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

int main()
{
	typedef std::map<std::string, char> FigureToIdent;
	FigureToIdent figure_to_idnt;
	figure_to_idnt.insert(std::make_pair("1100000011", 'A'));
	figure_to_idnt.insert(std::make_pair("1000000010000000100000001", 'B'));
	figure_to_idnt.insert(std::make_pair("1111", 'C'));
	figure_to_idnt.insert(std::make_pair("1000000110000001", 'D'));
	figure_to_idnt.insert(std::make_pair("11000000011", 'E'));
	figure_to_idnt.insert(std::make_pair("100000001100000001", 'F'));
	figure_to_idnt.insert(std::make_pair("110000011", 'G'));

	std::string input;
	while (getline(std::cin, input)) {
		if (input == "") {
			getline(std::cin, input);
		}
		for (std::uint16_t i = 1; i < 8; ++i) {
			std::string temp;
			getline(std::cin, temp);
			input += temp;
		}

		for (auto const& value : figure_to_idnt) {
			if (input.find(value.first) != std::string::npos) {
				std::cout << value.second << std::endl;
				break;
			}
		}
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
     char field[8][8];
     char tmp;
     int i,j;
    
     for(i=0;i<8;i++){
          for(j=0;j<8;j++){
               cin >> field[i][j];
          }
     }

     //»ê¼êÌ`ÉÂ¢Ä»Ê
     //Ü¸¶ãÌ}XðT·
     for(i=0;i<8;i++){
          for(j=0;j<8;j++){
               if(field[i][j]) goto NEXT;
          }
     }
    
     NEXT:
     if(field[i][j+1] && field[i][j+2] && field[i][j+3]){
          //¡êñ
	   cout << "C" << endl;
     }else if(field[i+1][j] && field[i+2][j] && field[i+3][j]){
          //cêñ
	   cout << "B" << endl;
     }else if(field[i][j+1] && field[i+1][j] && field[i+1][j+1]){
          //³û`
	   cout << "A" << endl;
     }else if(field[i+1][j] && field[i+1][j+1] && field[i+2][j+1]){
          //1 0
          //1 1
          //0 1
	   cout << "F" << endl;
     }else if(field[i][j+1] && field[i+1][j] && field[i+1][j-1]){
          //0 1 1
          //1 1 0
	   cout << "G" << endl;
     }else if(field[i][j+1] && field[i+1][j+1] && field[i+1][j+2]){
          //1 1 0
          //0 1 1
          cout << "E" << endl;
     }else{
	   cout << "D" << endl;
     }
     return 0;
}

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

string M[15];

int main() {

  for(int i=1; i<15; i++) M[i] = "                    ";
  
  while(cin>>M[0]) {
    for(int i=1; i<8; i++) cin >> M[i];
    
    char res = '#';
    
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(M[i][j]-'0') {
	  
	  if(M[i+1][j+1]-'0') {
	    if(M[i+2][j+1]-'0') {
	      res = 'F'; goto end;
	    } else if(M[i+1][j+2]-'0') {
	      res = 'E'; goto end;
	    } else {
	      res = 'A'; goto end;
	    }
	  }
	  
	  if(M[i+3][j]-'0') {
	    res = 'B'; goto end;
	  }

	  if(M[i][j+3]-'0') {
	    res = 'C'; goto end;
	  }

	  if(M[i-1][j+2]-'0') {
	    res = 'D'; goto end;
	  }

	  if(M[i+1][j-1]-'0') {
	    res = 'G'; goto end;
	  }
	  
	}
      }
    }
    end:
    cout << res << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
 
int main()
{
    char s[16][16]={0};
    while(cin >> s[0])
    {
        int y,x; char c;
        for(y=1; y<8; y++)
        cin >> s[y];
 
        for(y=0; y<8; y++)
        for(x=0; x<8; x++)
        s[y][x]-='0';
 
        for(y=0; y<64; y++)
        if(s[y/8][y%8])break;
 
        x=y%8; y/=8;
 
             if(s[y+3][x  ]) c='B';
        else if(s[y  ][x+3]) c='C';
        else if(s[y+1][x+2]) c='E';     
        else if(s[y+2][x+1]) c='F';
        else if(s[y+1][x+1]) c='A';
        else if(s[y  ][x+1]) c='G';
        else                 c='D';
 
        cout << c << endl;
    }
}