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)
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int b[20][20] = {{0}};
int &pos(int y, int x){
  return b[y+5][x+5];
}

int main(){
  string str;
  while(cin>>str){
    int i = 0;
    do{
      REP(j,8)
	pos(i,j) = str[j] - '0';
    }while(++i<8 && cin>>str);

    char ans;
    REP(y,8) REP(x,8){
      if(pos(y,x) == 1){
	if(pos(y+3,x) == 1)
	  ans = 'B';
	else if(pos(y,x+3) == 1)
	  ans = 'C';
	else if(pos(y+2,x-1) == 1)
	  ans = 'D';
	else if(pos(y+1,x+2) == 1)
	  ans = 'E';
	else if(pos(y+2,x+1) == 1)
	  ans = 'F';
	else if(pos(y,x+1) == 1 && pos(y+1,x-1) == 1)
	  ans = 'G';
	else
	  ans = 'A';
	goto end;
      }
    }
  end:
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
	char ch[8][8];
	bool judged;
	
	while((scanf("%s", ch[0])) != EOF){
		for(int i = 1; i < 8; i++){
				scanf("%s", ch[i]);
		}
		
		judged = false;
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(ch[i][j] == '1'){
					//A
					if(i + 1 < 8 && ch[i + 1][j] == '1' &&
					 j + 1 < 8 && ch[i][j + 1] == '1' &&
					 ch[i + 1][j + 1] == '1'){
						printf("A\n");
						judged = true;
						break;
					}
					//B
					if(i + 3 < 8 && ch[i + 1][j] == '1' &&
					 ch[i + 2][j] == '1' && ch[i + 3][j] == '1'){
						printf("B\n");
						judged = true;
						break;
					}
					//C
					if(j + 3 < 8 && ch[i][j + 1] == '1' &&
					 ch[i][j + 2] == '1' && ch[i][j + 3] == '1'){
						printf("C\n");
						judged = true;
						break;
					}
					//D
					if(i + 2 < 8 && j - 1 >= 0 &&
					 ch[j - 1][i + 1] == '1' && ch[j][i + 1] == '1' &&
					 ch[j - 1][i + 2] == '1'){
						printf("D\n");
						judged = true;
						break;
					}
					//E
					if(i + 1 < 8 && j + 2 < 8 &&
					 ch[i][j + 1] == '1' && ch[i + 1][j + 1] == '1' &&
					 ch[i + 1][j + 2] == '1'){
						printf("E\n");
						judged = true;
						break;
					}
					//F
					if(i + 2 < 8 && j + 1 < 8 &&
					 ch[i + 1][j] == '1' && ch[i + 1][j + 1] == '1' &&
					 ch[i + 2][j + 1] == '1'){
						printf("F\n");
						judged = true;
						break;
					}
					//G
					if(i + 1 < 8 && j + 1 < 8 && j - 1 >= 0 &&
					 ch[i + 1][j] == '1' && ch[i][j + 1] == '1' &&
					 ch[i + 1][j - 1] == '1'){
						printf("G\n");
						judged = true;
						break;
					}
				}
			}
			
			if(judged) break;
		}
	}
	
	return 0;
}

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


using namespace std;

char judge(vector<string> a){
  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      if(a.at(i)[j] == '1'){
	// not succession
	if(a[i].at(j+1) != '1'){
	  if(a[i+1].at(j-1) == '1'){
	    return 'D';
	  }else if(a[i+1].at(j+1) == '1'){
	    return 'F';
	  }else{
	    return 'B';
	  }
	}else{
	  // in succession
	  if(a[i].at(j+2) == '1'){
	    return 'C';
	  }else if(a[i+1].at(j+2) == '1'){
	    return 'E';
	  }else if(a[i+1].at(j-1) == '1'){
	    return 'G';
	  }else{
	    return 'A';
	  }
	}
      }
    }
  }
  return 'N';
}

int main(){

  while(true){
    vector<string> a;
    for(int j=0;j<8;j++){
      string s;
      cin >> s;
      a.push_back(s);
    }

    if(!cin){break;}
    
    cout << judge(a) << endl;
  }

  return 0;

}

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

using namespace std;

int A[7][4][4]={
  
  {
    {1,1,0,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
  },
  
  {
    {1,1,1,1},
    {0,0,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,0,0},
    {1,1,0,0},
    {1,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,1,0,0},
    {0,1,1,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,1,0,0},
    {0,1,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,1,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
},
  
  a[12][12];

string s="ABCDEFG";

void check(){


  for(int n=0;n<7;n++){

    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	bool fg=true;
	for(int k=0;k<4;k++){
	  for(int l=0;l<4;l++){
	    if(a[i+k][j+l]!=A[n][k][l]){
	      fg=false;
	      break;
	    }
	    if(i+k<0||i+k>7||j+l<0||j+k>7){
	      fg=false;
	      break;
	    }
	  }
	}
	if(fg){
	  cout << s[n] << endl;
	  return;
	}
	fg=true;

      }
    }
  }

}


int main(void){

  char ch;

  while(true){

    for(int i=0;i<12;i++)
      for(int j=0;j<12;j++)
	a[i][j]=0;
    
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	if(scanf(" %c",&ch)==EOF)return 0;
	a[i][j]=ch-'0';
      }
    }
    check();
  }

  return 0;
}