Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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 <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;
}

C++: #include <iostream>
#define rep(i,n) for(int i = 0 ; i < n ;i++ )
using namespace std;

int main(){
  int  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<iostream>
#include<cstdio>
using namespace std;
int main(){
  for(;;){
    int field[30][30]={0};
    if(scanf("%1d",&field[10][10]) == EOF) break;
    for(int i=0; i<8; i++){
      for(int j=0; j<8; j++){
	if(i == 0 && j == 0) continue;
	scanf("%1d",&field[10+i][10+j]);
      }
    }
    for(int i=0; i<8; i++){
      for(int j=0; j<8; j++){
	if(field[i+10][j+10] == 0) continue;
	if(field[i+11][j+10] == 1 && field[i+10][j+11] == 1 && field[i+11][j+11] == 1){cout <<"A"<<endl;goto flag;}
	if(field[i+11][j+10] == 1 && field[i+12][j+10] == 1 && field[i+13][j+10] == 1){cout <<"B"<<endl;goto flag;}
	if(field[i+10][j+11] == 1 && field[i+10][j+12] == 1 && field[i+10][j+13] == 1){cout <<"C"<<endl;goto flag;}
	if(field[i+11][j+10] == 1 && field[i+11][j+9] == 1 && field[i+12][j+9] == 1){cout <<"D"<<endl;goto flag;}
	if(field[i+10][j+11] == 1 && field[i+11][j+11] == 1 && field[i+11][j+12] == 1){cout <<"E"<<endl;goto flag;}
	if(field[i+11][j+10] == 1 && field[i+11][j+11] == 1 && field[i+12][j+11] == 1){cout <<"F"<<endl;goto flag;}
	if(field[i+10][j+11] == 1 && field[i+11][j+10] == 1 && field[i+11][j+9] == 1){cout <<"G"<<endl;goto flag;}
      }
    }
  flag:;
  }
  return 0;
}