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>

using namespace std;

void solve()
{
	char field[11][12];
	char a;
	while(cin >> a)
	{
		for(int i = 0; i < 11; ++i)
		{
			for(int j = 0; j < 12; ++j)
			{
				field[i][j] = '0';
			}
		}
		field[1][1] = a;
		for(int i = 2; i < 9; ++i)
		{
			cin >> field[1][i];
		}
		for(int i = 2; i < 9; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				cin >> field[i][j];
			}
		}
		for(int i = 1; i < 9; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				if(field[i][j] == '1')
				{
					if(field[i][j + 1] == '1' && field[i + 1][j] == '1' && field[i + 1][j + 1] == '1')
					{
						cout << "A" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i + 2][j] == '1' && field[i + 3][j] == '1')
					{
						cout << "B" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i][j + 2] == '1' && field[i][j + 3] == '1')
					{
						cout << "C" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i + 1][j - 1] == '1' && field[i + 2][j - 1] == '1')
					{
						cout << "D" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i + 1][j + 1] == '1' && field[i + 1][j + 2] == '1')
					{
						cout << "E" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i + 1][j + 1] == '1' && field[i + 2][j + 1] == '1')
					{
						cout << "F" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i + 1][j] == '1' && field[i + 1][j - 1] == '1')
					{
						cout << "G" << endl;
					}
					break;
				}
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

int field[8];

int zerocount()
{
	int count=0;
	for(int i=0;i<8;i++){
		if(field[i] == 0)
			count++;
	}
	return count-4;
}

int main()
{
	bool flag;
	while(cin >> field[0]){
		for(int i=1;i<8;i++){
			cin >> field[i];
		}
		switch(zerocount()){
			case 0:
				cout << 'B' << endl;
				break;
			case 1:
				flag = true;
				for(int i=0;i<8;i++){
					if(field[i] != 0 && flag == true){
						if((field[i] - field[i+2]) < 0){
							cout << 'D' << endl;
							flag = false;
							break;
						}else{
							cout << 'F' << endl;
							flag = false;
							break;
						}
					}
				}
				break;
			case 2:
				flag = true;
				for(int i=0;i<8;i++){
					if(field[i] != 0 && flag == true){
						if((field[i] - field[i+1]) == 0){
							cout << 'A' << endl;
							flag = false;
							break;
						}else if(field[i] - field[i+1] < 0){
							cout << 'G' << endl;
							flag = false;
							break;
						}else{
							cout << 'E' << endl;
							flag = false;
							break;
						}
					}
				}
				break;
			case 3:
				cout << 'C' << endl;
				break;
			default:
				break;
		}
	}
	return 0;
}

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

#define rep(i,n) for(int i = 0 ; i < n ;i++ )
using namespace std;

int main(){
 char  ma[8][8];
  while(!cin.eof()){
    rep(i,8){
      rep(j,8){
ma[i][j]='0';
      }
    }
    rep(i,8){
      rep(j,8){
	cin >> ma[i][j];

      }
    }
    rep(i,8){
      rep(j,8){
	if(ma[i][j]=='1'){
	  if(ma[i][j+1] == '1' && ma[i+1][j+1] == '1'&& i+1 < 8&&j+1 < 8 ){
	    cout << 'A' << endl;
	    goto f;
	  }else if(ma[i+3][j] == '1' &&i+3 < 8){
	    cout << 'B' << endl;
	    goto f;
	  }else if(ma[i][j+3] == '1'&& j+3 < 8){
	    cout << 'C' << endl;
	    goto f;
	  }else if(ma[i+3][j-1] == '1' && i+3 < 8 && 0 < j-1){
	    cout << 'D' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1<8 && j+3 < 8){
	    cout << 'E' << endl;
	    goto f;
	  }else if(ma[i+1][j+3] == '1' && i+1 < 8&& j+3 < 8){
	    cout << 'F' << endl;
	    goto f;
	  }else if(ma[i][j+1] == '1' && ma[i+1][j-1] == '1' && j+1 < 8 && i+1 < 8 && 0<j-1 ){
	    cout << 'G' << endl;
	    goto f;
	  }
	}
      }
    }
  f:
  }
  
  return 0;
}

C++: #include<cstdio>

class pair{
  public:
  bool b;
  int i;
  int j;
  void init(int i){
    b = i ? true : false;
    i = j = 0;
  }
};

using namespace std;
int main(){
  int s[8][8];
  pair x;
  while(scanf("%1d",&s[0][0])!=EOF){
    x.init(s[0][0]);
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
        if(i==0&&j==0)j++;
        scanf("%1d",&s[i][j]);
        if(!x.b&&s[i][j]){
          x.i=i;
          x.j=j;
          x.b=true;
        }
      }
    }
    
    for(int i=0;i<8;i++){for(int j=0;j<8;j++)printf("%d",s[i][j]);printf("\n");}
    printf("%d %d\n",x.i,x.j);

    if(x.j!=7){
      if(s[x.i][x.j+1]){
        if(x.i!=7){
          if(s[x.i+1][x.j]){
            if(s[x.i+1][x.j+1])printf("A\n");
            else printf("G\n");
          }
          else if(s[x.i+1][x.j+1])printf("E\n");
          else printf("C\n");
          }
        else printf("C\n");
      }
      else if(s[x.i+1][x.j+1])printf("F\n");
      else if(x.j!=0){
        if(s[x.i+1][x.j-1])printf("D\n");
        else printf("B\n");
      }
      else printf("B\n");
    }
    else if(x.j!=0){
      if(s[x.i+1][x.j-1])printf("D\n");
      else printf("B\n");
    }
    else printf("B\n");
  }
  return 0;
}

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

typedef pair<int, int> p;
p shapes[7][3] = 
{
	{ p(1, 0), p(0, 1), p(1, 1)		},
	{ p(0, 1), p(0, 2), p(0, 3)		},
	{ p(1, 0), p(2, 0), p(3, 0)		},
	{ p(0, 1), p(-1, 1), p(-1, 2)	},
	{ p(1, 0), p(1, 1), p(2, 1)		},
	{ p(0, 1), p(1, 1), p(1, 2)		},
	{ p(1, 0), p(0, 1), p(-1, 1)	}
};
string table[8];

int main()
{
	while (true)
	{
		for (int i = 0; i < 8; i++)
		{
			if (!(cin >> table[i])) return 0;
		}

		p upperLeft;
		for (int y = 0; y < 8; y++)
		{
			for (int x = 0; x < 8; x++)
			{
				if (table[y][x] == '1')
				{
					upperLeft = p(x, y);
					goto Break;
				}
			}
		}
		Break:

		for (int i = 0; i < 7; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				int X = upperLeft.first + shapes[i][j].first;
				int Y = upperLeft.second + shapes[i][j].second;
				if (!(0 <= X && X < 8 && 0 <= Y && Y < 8)) break;
				if (table[Y][X] == '0') break;
				if (j == 2) cout << char('A' + i) << endl;
			}
		}
	}

	return 0;
}