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 <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	char p[8][9];
	int i,j;
	while(cin>>p[0]>>p[1]>>p[2]>>p[3]>>p[4]>>p[5]>>p[6]>>p[7]){
		for(i=0; i<8 ; ++i){
			for(j=0 ;j < 9 ; ++j){
				if(p[i][j]=='1') goto next; 
			}
		}
		next:
		if (p[i][j+1]=='1' &&p[i+1][j]=='1' && p[i+1][j+1]=='1') cout << 'A' << endl;
		else if (p[i+1][j]=='1' && p[i+2][j]=='1' && p[i+3][j]=='1') cout << 'B' << endl;
		else if (p[i][j+1]=='1' && p[i][j+2]=='1' && p[i][j+3]=='1') cout << 'C' << endl;
		else if (p[i+1][j]=='1' && p[i+1][j-1]=='1' && p[i+2][j-1]=='1' ) cout << 'D' << endl;
		else if (p[i][j+1]=='1' && p[i+1][j+1]=='1' && p[i+1][j+2]=='1' ) cout << 'E' << endl;
		else if (p[i+1][j]=='1' && p[i+1][j+1]=='1' && p[i+2][j+1]=='1' ) cout << 'F' << endl;
		else if (p[i][j+1]=='1' && p[i+1][j]=='1' && p[i+1][j-1]=='1' ) cout << 'G' << endl;
	}
	return 0; 
}

C++: //a
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
 
#define REP(i,b,n) for(int i=b;i<n;++i)
#define REPR(i,b,n) for(int i=n-1;i>=b;--i)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PI acos(-1.0)

using namespace std;

static const double EPS = 1e-9;
typedef pair<double, int> stn;
typedef long long ll;

string ptn[7] = {	"1100110000000000",
					"1000100010001000",
					"1111000000000000",
					"0100110010000000",
					"1100011000000000",
					"1000110001000000"
					"0110110000000000"};

int main(){
	
	while(!cin.eof()){
	
		char ans = 0;
		vector<string> surf = vector<string>(16, "0000000000000000");
		
		for(int i = 0; i < 8; ++i){
		
			string str;
			cin >> str;
			surf[i] = str;
		}
		
		for(int y = 0; y < 8; ++y){
			for(int x = 0; x < 8; ++x){
				
				if(surf[y][x] == '1'){
					for(int k = 0; k < 7; ++k){
						
						int cnt = 0;
						
						for(int i = 0; i < 16; ++i){
							if( ptn[k][i] == surf[y+i/4][x+i%4] )
								cnt++;
							else
								break;
						}
						
						if(cnt>=16){
							ans = char('A'+k);
							goto out;
						}
						
					}
				}
				
			}
		}
		
	out:
		if(ans)
			cout << ans << endl;
	}
	
	return 0;
}

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

string map[8];

void check( int x, int y ){
	int blocks[7][3][2] = {
		{{1,0}, {0,1}, {1,1}},
		{{0,1}, {0,2}, {0,3}},
		{{1,0}, {2,0}, {3,0}},
		{{0,1}, {-1,1}, {-1,2}},
		{{1,0}, {1,1}, {2,1}},
		{{0,1}, {1,1}, {1,2}},
		{{1,0}, {0,1}, {-1,1}}
	};
	for( int i=0; i<7; i++ ){
		bool match = true;
		for( int j=0; j<3; j++ ){
			int xx = x+blocks[i][j][0];
			int yy = y+blocks[i][j][1];
			if( xx<0 || xx>=8 || yy<0 || yy>=8 ){
				match = false;
				break;
			}
			if( map[yy][xx] == '0' ){
				match = false;
			}
		}
		if( match ){
			cout << (char)('A'+i) << endl;
			break;
		}
	}
}

int main(){
	while(1){
		int k = -1;
		for( int i=0; i<8; i++ ){
			getline( cin, map[i] );
			if( map[i].length() != 8 )	return 0;
			if( k==-1 && map[i]!="00000000" ){
				k = i;
			}
		}
		for( int i=0; i<8; i++ ){
			if( map[k][i] == '1' ){
				check(i, k);
				break;
			}
		}
		string br;
		getline( cin, br );
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	while(1){
		int b[8][8]={0};
		string str;
		for(int i=0;i<8;i++){
			cin>>str;
			for(int j=0;j<8;j++){
				b[i][j]=str[j]-48;
			}
		}
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(b[i][j] && b[i+1][j] && b[i][j+1] && b[i+1][j+1]){
					cout<<"A"<<endl;
					goto label;
				}else if(b[i][j] && b[i+1][j] && b[i+2][j] && b[i+3][j]){ 
					cout<<"B"<<endl;
					goto label;
				}else if(b[i][j] && b[i][j+1] && b[i][j+2] && b[i][j+3]){
					cout<<"C"<<endl;
					goto label;
				}else if(b[i][j] && b[i+1][j] && b[i+1][j-1] && b[i+2][j-1]){
					cout<<"D"<<endl;
					goto label;
				}else if(b[i][j] && b[i][j+1] && b[i+1][j+1] && b[i+1][j+2]){
					cout<<"E"<<endl;
					goto label;
				}else if(b[i][j] && b[i+1][j] && b[i+1][j+1] && b[i+2][j+1]){
					cout<<"F"<<endl;
					goto label;
				}else if(b[i][j] && b[i][j+1] && b[i+1][j] && b[i+1][j-1]){ 
					cout<<"G"<<endl;
					goto label;
				}
			}
		}
		label:;
	}
	return 0;
}