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<string>

using namespace std;

int main(void)
{
	string s,shape[7];
	string tmp;
	shape[0]="1100000011";
	shape[1]="1000000010000000100000001";
	shape[2]="1111";
	shape[3]="1000000110000001";
	shape[4]="11000000011";
	shape[5]="100000001100000001";
	shape[6]="110000011";
	while(cin>>s)
	{
		for(int i=0;i<7;i++)
		{
			cin>>tmp;
			s+=tmp;
		}
		for(int i=0;i<7;i++)
		{
			if(s.find(shape[i])!=string::npos)
			{
				cout<<(char)('A'+i)<<endl;
			}
		}
	}
}

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

int mat[8][8];

void put_mat(int i,int j){

		if(mat[i+1][j] && mat[i][j+1] && mat[i+1][j+1]){
				printf("A\n");
				return;
		}

		if(mat[i+1][j] && mat[i+2][j] && mat[i+3][j]){
				printf("B\n");
				return;
		}

		if(mat[i][j+1] && mat[i][j+2] && mat[i][j+3]){
				printf("C\n");
				return;
		}

		if(mat[i+1][j] && mat[i+1][j-1] && mat[i+2][j-2]){
				printf("D\n");
				return;
		}

		if(mat[i][j+1] && mat[i+1][j+1] && mat[i+1][j+2]){
				printf("E\n");
				return;
		}

		if(mat[i+1][j] && mat[i+1][j+1] && mat[i+2][j+1]){
				printf("F\n");
				return;
		}

		if(mat[i][j+1] && mat[i+1][j] && mat[i+1][j-1]){
				printf("G\n");
				return;
		}
}

int main(void){
		int i,j,n;
		while(true){
				for(i=0;i<8;i++){
						for(j=0;j<8;j++){
								mat[i][j] = 0;
						}
				}
				
				for(i=0;i<8;i++){
						for(j=0;j<8;j++){
								if(scanf("%d",&n) == EOF)
										return 0;
								mat[i][j] = n;
						}
				}
				
				bool flag = false;
				for(i=0;i<8;i++){
						for(j=0;j<8;j++){
								if(mat[i][j] == 1)
										goto HERE;
						}
				}
HERE:
				put_mat(i,j);
		}

		return 0;
}

C++: #include <iostream>

using namespace std;

char p[8][9];

bool m(int i, int j) {
  return 0 <= i && i < 8 && 0 <= j && j < 8 && p[i][j] == '1';
}

int main() {
  while (cin >> p[0], !cin.eof()) {
    for (int i = 1; i < 8; i++)
      cin >> p[i];
    for (int i = 0; i < 8; i++)
      cout << p[i] << endl;
    for (int i = 0; i < 8; i++)
      for (int j = 0; j < 8; j++)
        if (p[i][j] == '1') {
          if (m(i, j+1) && m(i+1, j) && m(i+1, j+1))
            cout << 'A' << endl;
          else if (m(i+1, j) && m(i+2, j) && m(i+3, j))
            cout << 'B' << endl;
          else if (m(i, j+1) && m(i, j+2) && m(i, j+3))
            cout << 'C' << endl;
          else if (m(i+1, j) && m(i+1, j-1) && m(i+2, j-1))
            cout << 'D' << endl;
          else if (m(i, j+1) && m(i+1, j+1) && m(i+1, j+2))
            cout << 'E' << endl;
          else if (m(i+1, j) && m(i+1, j+1) && m(i+2, j+1))
            cout << 'F' << endl;
          else
            cout << 'G' << endl;
          goto epilogue;
        }
epilogue:;
  }
}

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++)
		for(int j=0; j<12; j++)
			n[i][j]='0';
}

int main(){
	clear();
	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n", n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])){

		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;
					}

				}
			}
		}
		clear();
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<math.h>
#include<bitset>
using namespace std;
int main(){
	int a,b;
	char map[64];
	int movex[4]={1,0,-1,0},movey[4]={0,1,0,-1};
	while(cin>>map[0]){
		for(int i=1;i<64;i++){
			cin>>map[i];
		}
		int i,j;
		for(i=0;i<64;i++){
			if(map[i]=='1'){
				break;
			}
		}
		if(map[i+1]=='1'){
			if(map[i+8]=='1'&&map[i+9]=='1'){
				cout<<"A"<<endl;
			}
			else if(map[i+2]=='1'&&map[i+3]=='1'){
				cout<<"C"<<endl;
			}
			else if(map[i+9]=='1'&&map[i+10]=='1'){
				cout<<"E"<<endl;
			}
			else if(map[i+7]=='1'&&map[i+8]=='1'){
				cout<<"G"<<endl;
			}
		}
		else if(map[i+8]=='1'){
			if(map[i+16]=='1'&&map[i+24]=='1'){
				cout<<"B"<<endl;
			}
			else if(map[i+7]=='1'&&map[i+15]){
				cout<<"D"<<endl;
			}
			else if(map[i+9]=='1'&&map[i+17]=='1'){
				cout<<"F"<<endl;
			}
		}
		memset(map,'0',sizeof(map));
	}
	return 0;
}