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 <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() {
	vector< vector<Point> > figs = { 
		{Point(0,0),Point(1,0),Point(0,1),Point(1,1)},
		{Point(0,0),Point(0,1),Point(0,2),Point(0,3)},
		{Point(0,0),Point(1,0),Point(2,0),Point(3,0)},
		{Point(0,0),Point(-1,1),Point(0,1),Point(-1,2)},
		{Point(0,0),Point(1,0),Point(1,1),Point(2,1)},
		{Point(0,0),Point(0,1),Point(1,1),Point(1,2)},
		{Point(0,0),Point(1,0),Point(-1,1),Point(0,1)}
	};
	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 <cstdio>

using namespace std;

char fig [9][9];

int main()
{
	
	while (scanf("%s", fig[0]) != EOF){
		for (int i = 1; i < 8; i++){
			scanf("%s", fig[i]);
		}
		
		for (int y = 0; y < 8; y++){
			for (int x = 0; x < 8; x++){
				if (fig[y][x] != '0'){
					if (fig[y][x + 1] == '1' && fig[y + 1][x] == '1' && fig[y + 1][x + 1] == '1'){
						printf("A\n");
						y = 10;
						break;
					}
					else if(fig[y + 1][x] == '1' && fig[y + 2][x] == '1' && fig[y + 3][x] == '1'){
						printf("B\n");
						y = 10;
						break;
					}
					else if(fig[y][x + 1] == '1' && fig[y][x + 2] == '1' && fig[y][x + 3] == '1'){
						printf("C\n");
						y = 10;
						break;
					}
					else if(fig[y + 1][x] == '1' && fig[y + 1][x - 1] == '1' && fig[y + 2][x - 1] == '1'){
						printf("D\n");
						y = 10;
						break;
					}
					else if(fig[y][x + 1] == '1' && fig[y + 1][x + 1] == '1' && fig[y + 1][x + 2] == '1'){
						printf("E\n");
						y = 10;
						break;
					}
					else if(fig[y + 1][x] == '1' && fig[y + 1][x + 1] == '1' && fig[y + 2][x + 1] == '1'){
						printf("F\n");
						y = 10;
						break;
					}
				}
			}
		}
	}
}

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

int main() {
  string str[8];
  while(1) {
    for ( int i = 0; i < 8; i++ ) cin >> str[i];
    if ( cin.eof() ) return 0;
    char ans;
    for ( int i = 0; i < 8; i++ ) {
      for ( int j = 0; j < 8; j++ ) {
      if ( str[i][j] == '1' && str[i][j+1] == '1' && 
	   str[i+1][j] == '1' && str[i+1][j+1] == '1' ) ans = 'A';
      else if ( str[i][j] == '1' && str[i+1][j] == '1' &&
		str[i+2][j] == '1' && str[i+3][j] =='1' ) ans = 'B';
      else if ( str[i][j] == '1' && str[i][j+1] == '1' &&
		str[i][j+2] == '1' && str[i][j+3] == '1' ) ans = 'C';
      else if ( str[i][j] == '1' && str[i+1][j-1] == '1' &&
		str[i+1][j] == '1' && str[i+2][j-1] == '1' ) ans = 'D';
      else if ( str[i][j] == '1' && str[i][j+1] == '1' &&
		str[i+1][j+1] == '1' && str[i+1][j+2] == '1' ) ans = 'E';
      else if ( str[i][j] == '1' && str[i+1][j] == '1' &&
		str[i+1][j+1] == '1' && str[i+2][j+1] == '1' ) ans = 'F';
      else if ( str[i][j] == '1' && str[i][j+1] == '1' &&
		str[i+1][j-1] == '1' && str[i+1][j] == '1' ) ans = 'G';
							 
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

char n[12][12];
char figure[7][4][5] = {
	{"1100","1100","0000","0000"},
	{"1000","1000","1000","1000"},
	{"1111","0000","0000","0000"},
	{"0100","1100","1000","0000"},
	{"1100","0110","0000","0000"},
	{"1000","1100","0100","0000"},
	{"0110","1100","0000","0000"}
};


void clear(){
	for(int i=0; i<12; i++)
			n[i][8]='0';
}

int main(){
	for(int i=0; i<12; i++)
		for(int j=0; j<12; j++)
			n[i][j]='0';

	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n\n", n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])){
		clear();
		for(int i=0; i<7; i++){
			for(int j=0; j<8; j++){
				for(int k=0; k<8; k++){
					bool flag=true;
					
					for(int x=0; x<4; x++){
						for(int y=0; y<4; y++){
							if(figure[i][x][y] != n[j+x][k+y]) flag = false;
						}
					}
					
					if(flag){
						cout << (char)('A'+i) << endl;
					}

				}
			}
		}
	}
	return 0;
}