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>

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(fg){
	cout << s[n] << endl;
	  return;
	}
	fg=true;

      }
    }
  }

}


int main(void){

  char ch;

  while(true){
    
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	cin.get(ch);
	if(cin.eof())return 0;
	a[i][j]=ch-'0';
      }
      cin.ignore();
    }
    check();
  }

  return 0;
}

C++: #include<iostream>
#include<vector>
int main(){
	std::vector<std::vector<int> > vec(8,std::vector<int>(8));
	while(1){
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				std::cin>>vec[i][j];
			}
		}
		if(std::cin.eof())break;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(vec[i][j]==1){
					if(vec[i][j+1]==1&&vec[i+1][j]==1&&vec[i+1][j+1]==1)std::cout<<"A"<<std::endl;
					if(vec[i+1][j]==1&&vec[i+2][j]==1&&vec[i+3][j]==1)std::cout<<"B"<<std::endl;
					if(vec[i][j+1]==1&&vec[i][j+2]==1&&vec[i][j+3]==1)std::cout<<"C"<<std::endl;
					if(vec[i+1][j]==1&&vec[i+1][j-1]==1&&vec[i+2][j-1]==1)std::cout<<"D"<<std::endl;
					if(vec[i][j+1]==1&&vec[i+1][j+1]==1&&vec[i+1][j+2]==1)std::cout<<"E"<<std::endl;
					if(vec[i+1][j+1]==1&&vec[i+1][j+1]==1&&vec[i+2][j+1]==1)std::cout<<"F"<<std::endl;
					if(vec[i][j+1]==1&&vec[i+1][j]==1&&vec[i+1][j-1]==1)std::cout<<"G"<<std::endl;
				}
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}
void Solve(vector<vector<char>> vvc){
  int x = 0,y = 0;
  rep(i,8){
    rep(j,8){
      if(vvc[j][i] == '1'){
        x = j;
        y = i;
        j = 8;
        i = 8;
        break;
      }
    }
  }
  if(x + 1 < 8 && vvc[x+1][y] == '1'){//A,C,E,G
    if(x+2 < 8 && vvc[x+2][y] == '1'){
      cout << 'C'<<endl;
    }
    else if( x-1 >= 0 && y+1 < 8&& vvc[x-1][y+1] == '1'){
      cout << 'G'<<endl;
    }
    else if( y +1 < 8 && vvc[x][y+1] == '1'){
      cout << 'A'<<endl;
    }
    else{
      cout << 'E'<<endl;
    }
  }
  else{//B,D,F
    if(y+2 < 8 && vvc[x][y+2] == '1'){
      cout << 'B'<<endl;
    }
    else if( x+1 < 8 && y + 1 < 8&& vvc[x+1][y+1] == '1'){
      cout << 'F'<<endl;
    }
    else{
      cout << 'D'<<endl;
    }
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(1){
    vector<vector<char>> v(8,vector<char>(8,0));
    rep(i,8){
      rep(j,8){
        cin>> v[j][i];
      }
    }
    if(cin.eof()){
      break;
    }
    Solve(v);
  }
  return 0;
}

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

int main(){
	char a[8][8];
	while(cin){
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++) a[i][j] = '0';
			for(int j=0;j<8;j++) cin >> a[i][j];
		}
		int x = 0;
		int y = 0;
		int z = 0;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(a[i][j]=='1'){
					if(j<7 and a[i][j+1]=='1') x++;
					if(i<7 and a[i+1][j]=='1') y++;
					if(i<7 and j<7 and a[i+1][j+1]=='1') z++;
				}
			}
		}
		if     (x==3 and y==0 and z==0) cout << "C" << endl;
		else if(x==0 and y==3 and z==0) cout << "B" << endl;
		else if(x==2 and y==2 and z==1) cout << "A" << endl;
		else if(x==1 and y==2 and z==0) cout << "D" << endl;
		else if(x==2 and y==1 and z==0) cout << "G" << endl;
		else if(x==2 and y==1 and z==2) cout << "E" << endl;
		else if(x==1 and y==2 and z==2) cout << "F" << endl;
	}
}