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<iostream>
#include<string>
#include<vector>
#define MAX 8
using namespace std;

int main(void){
  vector<vector<char> > inp(MAX,vector<char>(MAX));
  vector<vector<int> > buf(MAX,vector<int>(MAX));
  while(cin>>inp[0][0]){
    buf[0][0]=inp[0][0]-'0';
    for(int i = 1 ; i < MAX ; i ++){
      cin>>inp[0][i];
      buf[0][i]=inp[0][i]-'0';
    }
    for(int i = 1 ; i < MAX ; i ++)
      for(int j = 0 ; j < MAX ; j ++){
        cin>>inp[i][j];
        buf[i][j]=inp[i][j]-'0'; 
      }
//cout<<buf[0][3]<<" "<<buf[0][6]<<endl;
    
    bool find=false;
    char ans;
    for(int i = 0 ; i < MAX ; i ++){
      if(find)break;
      for(int j = 0 ; j < MAX ; j ++){
        if(buf[i][j]){
          ans='O';
          if(0<=i&&i<MAX-1 && 0<=j&&j<MAX-1&&buf[i+1][j]&&buf[i][j+1]&&buf[i+1][j+1])ans='A';
          else if(0<=i&&i<MAX-3 && 0<=j&&j<MAX&&buf[i+3][j])ans='B';
          else if(0<=i&&i<MAX && 0<=j&&j<MAX-3&&buf[i][j+3])ans='C';
          else if(0+1<=i&&i<MAX-1 && 0<=j&&j<MAX-2&&buf[i-1][j+2])ans='D';
          else if(0<=i&&i<MAX-1 && 0<=j&&j<MAX-2&&buf[i+1][j+2])ans='E';
          else if(0<=i&&i<MAX-2 && 0<=j&&j<MAX-1&&buf[i+2][j+1])ans='F';
          else if(0+1<=i&&i<MAX-1 && 0<=j&&j<MAX-1&&buf[i][j+1]&&buf[i+1][j-1])ans='G';
          find = true;
          break;
        } 
      }
    }
    cout<<ans<<endl;
    
  }
}

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

char ch[8][8]={};
bool check(int x, int y){
  return (0<=x && x<8 && 0<=y && y<8)&&(ch[x][y]=='1');
}

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

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

string field[8];

bool ch(int i,int j)
{
	if(field[i][j] == '1') return true;
	return false;
}

bool Check_A(int i,int j)
{
	if(i+1 < 8 && j+1 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j+1))  return true;
	}
	return false;
}

bool Check_B(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i+3,j)) return true;
	}
	return false;
}

bool Check_C(int i,int j)
{
	if(j+1 < 8 && j+2 < 8 && j+3 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i,j+2) && ch(i,j+3)) return true;
	}
	return false;
}

bool Check_D(int i,int j)
{
	if(j-1 >= 0 && i+1 < 8 && i+2 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+1,j-1) && ch(i+2,j-1)) return true;
	}
	return false;
}

bool Check_E(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j+2 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i+1,j+1) && ch(i+1,j+2)) return true;
	}
	return false;
}

bool Check_F(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+1,j+1)&& ch(i+2,j+1)) return true;
	}
	return false;
}

bool Check_G(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j-1 >= 0)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j-1)) return true;
	}
	return false;
}

int main()
{
	while(cin >> field[0])
	{
		for(int i=1;i<8;i++)
		{
			cin >> field[i];
		}
		
		bool flag = true;
		for(int i=0;i<8;i++)
		{
			for(int j=0;j<8;j++)
			{
				if(Check_A(i,j) && flag)
				{
					cout << "A" << endl;
					flag = false;
				}

				if(Check_B(i,j) && flag)
				{
					cout << "B" << endl;
					flag = false;
				}

				if(Check_C(i,j) && flag)
				{
					cout << "C" << endl;
					flag = false;
				}

				if(Check_D(i,j) && flag)
				{
					cout << "D" << endl;
					flag = false;
				}				

				if(Check_E(i,j) && flag)
				{
					cout << "E" << endl;
					flag = false;
				}

				if(Check_F(i,j) && flag)
				{
					cout << "F" << endl;
					flag = false;
				}

				if(Check_G(i,j) && flag)
				{
					cout << "G" << endl;
					flag = false;
				}
			}
		}
	}
	return 0;
}

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&&x[0]==x[3]+1) cout<<"D"<<endl;
     else if(x[1]==x[2]&&(x[3]==x[0]+2&&y[3]==y[0]+1)) 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;
 }