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 <vector>
#include <cstdio>
using namespace std;

struct Point{
public:
	int x,y;
	Point(int _x, int _y){x=_x;y=_y;}
	void show(){cout<<x<<","<<y<<endl;}
	bool eq(Point &a){return x==a.x && y==a.y;}
};

bool eqFig(vector<Point> &a, vector<Point> &b){
	if(a.size()!=b.size()){
		return false;
	}else{
		vector<Point>::iterator ita=a.begin(), itb=b.begin();
		for(;ita<a.end();++ita,++itb){
			if(!(ita->eq(*itb))){
				return false;
			}
		}
		return true;
	}
}

int main() {
	Point fig_a[4] = {Point(0,0),Point(1,0),Point(0,1),Point(1,1)};
	Point fig_b[4] = {Point(0,0),Point(0,1),Point(0,2),Point(0,3)};
	Point fig_c[4] = {Point(0,0),Point(1,0),Point(2,0),Point(3,0)};
	Point fig_d[4] = {Point(0,0),Point(-1,1),Point(0,1),Point(-1,2)};
	Point fig_e[4] = {Point(0,0),Point(1,0),Point(1,1),Point(2,1)};
	Point fig_f[4] = {Point(0,0),Point(0,1),Point(1,1),Point(1,2)};
	Point fig_g[4] = {Point(0,0),Point(1,0),Point(-1,1),Point(0,1)};
	vector<Point> _figs[7] = {vector<Point>(fig_a,fig_a+4),
		vector<Point>(fig_b,fig_b+4),
		vector<Point>(fig_c,fig_c+4),
		vector<Point>(fig_d,fig_d+4),
		vector<Point>(fig_e,fig_e+4),
		vector<Point>(fig_f,fig_f+4),
		vector<Point>(fig_g,fig_g+4)
	};
	vector< vector<Point> > figs(_figs,_figs+7);
	vector<Point>fig;
	unsigned char ch;
	
	do{
		fig.clear();
		int x=0,y=0,sx;
		bool flg=false;
		
		for(int i=0;i<8;++i){
			for(int j=0;j<8;++j){
				ch = getchar();
				if(ch == '1'){
					fig.push_back(Point(x,y));
					if(!flg)sx = j;
					flg = true;
				}
				if(flg){
					x = 1 + j - sx;
				}
			}
			if(flg)++y;
			getchar();
		}
		
		for(int i=0;i<7;++i){
			if(eqFig(figs[i],fig)){
				cout<<(char)('A'+i)<<endl;
				break;
			}
		}
		
	}while(getchar()!=EOF);
	return 0;
}

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

typedef complex<int> P;

namespace std{
	bool operator < (const P &a,const P &b){
		if( a.real() != b.real() ) return a.real() < b.real();
		return a.imag() < b.imag();
	}
	bool operator == (const P &a,const P &b){
		if( a.real() != b.real() ) return false;
		return a.imag() == b.imag();
	}
};

vector<vector<P>> ptn = {
	{P(0,0),P(1,1),P(1,0),P(0,1)},
	{P(0,0),P(0,2),P(0,1),P(0,3)},
	{P(0,0),P(1,0),P(2,0),P(3,0)},
	{P(1,0),P(1,1),P(0,1),P(0,2)},
	{P(0,0),P(1,0),P(1,1),P(2,1)},
	{P(0,0),P(0,1),P(1,1),P(1,2)},
	{P(1,0),P(2,0),P(0,1),P(1,1)}
};

string s[8];
int main(){
	while(true){
		for(int i = 0 ; i < 8 ; i++){
			if(!(cin >> s[i]))exit(0);
			
		}
		for(int i = 0 ; i < 7 ; i++)
			sort(ptn[i].begin(),ptn[i].end());
		for(int i = -10 ; i <= 10 ; i++)
			for(int j = -10 ; j <= 10 ; j++){
				vector<P> tmp;
				for(int y = 0 ; y < 8 ; y++)
					for(int x = 0 ; x < 8 ; x++){
						if( s[y][x] == '1'){
							tmp.push_back(P(x-j,y-i));
						}
					}
				sort(tmp.begin(),tmp.end());
				for(int k = 0 ; k < 7 ; k++){
					if( tmp == ptn[k] ){
						cout << (char)(k+'A') << endl;
					}
				}
			}
	}
					
					
	
	
}

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

string M[15];

int main() {
  char dum;
  
  while(1) {
    for(int i=0; i<8; i++) {
      if(!(cin >> M[i])) return 0;
    }

    char res = 'b';
    
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(M[i][j]-'0') {
	  
	  if(M[i+1][j+1]-'0') {
	    if(M[i+2][j+1]-'0') {
	      res = 'F'; goto end;
	    } else if(M[i+1][j+2]-'0') {
	      res = 'E'; goto end;
	    } else {
	      res = 'A'; goto end;
	    }
	  }
	  
	  if(M[i+3][j]-'0') {
	    res = 'B'; goto end;
	  }

	  if(M[i][j+3]-'0') {
	    res = 'C'; goto end;
	  }

	  if(M[i-1][j+2]-'0') {
	    res = 'D'; goto end;
	  }

	  if(M[i+1][j-1]-'0') {
	    res = 'G'; goto end;
	  }
	  
	}
      }
    }
    end:
    cout << res << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
char G[8][8];
bool p(int i, int j){
if ( !(0 <= i && i < 8 && 0 <= j && j < 8) ) return false;
return G[i][j] == '1';
}
main(){
    while( cin >> G[0][0] ){
	int si = 0, sj = 0;
	rep(i, 8) rep(j, 8) {
	    if (i + j == 0) continue;
	    cin >> G[i][j];
	    if(G[i][j] == '1') { si = i; sj = j;}
	}
	if ( p(si-3, sj) ) cout << "B" << endl;
	else if ( p(si, sj-3) ) cout << "C" << endl;
	else if ( p(si-2, sj+1)) cout << "D" << endl;
	else if ( p(si-1, sj-2)) cout << "E" << endl;
	else if ( p(si-2, sj-1)) cout << "F" << endl;
	else if ( p(si, sj-1) && p(si-1, sj+1) ) cout << "G" << endl;
	else cout << "A" << endl;
    }
}

C++: #include <iostream>

#define limit(A,X,C) ((X<A)?A:(C<X)?C:X)

char map[8+1][8]={0};

int pget(int x,int y)
{
	if(limit(0,x,7)==x && limit(0,y,7)==y)
		return map[y][x]-'0';
	return 0;
}

char check(int x, int y)
{
	//std::cout << ":" << x << y << std::endl;
	if(pget(x+1,y))
	{
		if(pget(x+2,y))
			return 'C';
		if(!pget(x,y+1))
			return 'E';
		if(pget(x+1,y+1))
			return 'A';
		return 'G';
	}
	if(pget(x,y+2))
		return 'B';
	if(pget(x+1,y+2))
		return 'F';
	return 'D';
}

int main(void)
{
	do
	{
		for(int i=0; i<8; i++)
			std::cin >> map[i];
		int x,y;
		bool end=false;
		for(y=0; y<8; y++)
		{
			for(x=0; x<8; x++)
				if(map[y][x] == '1')
				{
					end=true;
					break;
				}
			if(end)
				break;
		}

		std::cout << check(x,y) << std::endl;
	}while(std::cin >> map[0][0]);
	
	return 0;
}