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)
		fmt.Scanln()
	}
}

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