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

int dt[24][24];

int num=0;

bool checkA(int i,int j){
	if(dt[i+1][j]==1 && dt[i][j+1]==1 && dt[i+1][j+1]==1 && dt[i][j]==1)return true;
	else if(dt[i][j-1]==1 && dt[i+1][j-1]==1 && dt[i+1][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-1][j]==1 && dt[i-1][j+1]==1 && dt[i][j+1]==1 && dt[i][j]==1)return true;
	else if(dt[i-1][j-1]==1 && dt[i][j-1]==1 && dt[i-1][j]==1 && dt[i][j]==1)return true;
	else return false;
}

bool checkB(int  i,int j){
	if(dt[i+1][j]==1 && dt[i+2][j]==1 && dt[i+3][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-1][j]==1 && dt[i+1][j]==1 && dt[i+2][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-2][j]==1 && dt[i-1][j]==1 && dt[i+1][j]==1 && dt[i][j]==1)return true;
	else if(dt[i-3][j]==1 && dt[i-2][j]==1 && dt[i-1][j]==1 && dt[i][j]==1)return true;
	else return false;
}

bool checkC(int i,int j){
	if(dt[i][j]==1){
		if(dt[i][j+1]==1 && dt[i][j+2]==1 && dt[i][j+3]==1)return true;
		else if(dt[i][j-1]==1 && dt[i][j+1]==1 && dt[i][j+2]==1)return true;
		else if(dt[i][j-2]==1 && dt[i][j-1]==1 && dt[i][j+1]==1)return true;
		else if(dt[i][j-3]==1 && dt[i][j-2]==1 && dt[i][j-1]==1)return true;
		else return false;
	}else return false;
}

bool checkD(int i,int j){
	if(dt[i][j]==1){
		if(dt[i+1][j]==1 && dt[i+1][j-1]==1 && dt[i+2][j-1]==1)return true;
		else if(dt[i-1][j]==1 && dt[i][j-1]==1 && dt[i+1][j-1]==1)return true;
		else if(dt[i][j+1]==1 && dt[i-1][j+1]==1 && dt[i+1][j]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j+1]==1 && dt[i-2][j+1]==1)return true;
		else return false;
	}else return false;
}

bool checkE(int i,int j){
	if(dt[i][j]==1){
		if(dt[i][j+1]==1 && dt[i+1][j+1]==1 && dt[i+1][j+2]==1)return true;
		else if(dt[i][j-1]==1 && dt[i+1][j]==1 && dt[i+1][j+1]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j-1]==1 && dt[i][j+1]==1)return true;
		else if(dt[i][j-1]==1 && dt[i-1][j-1]==1 && dt[i-1][j-2]==1)return true;
		else return false;
	}else return false;
}

bool checkF(int i,int j){
	if(dt[i][j]==1){
		if(dt[i+1][j]==1 && dt[i+1][j+1]==1 && dt[i+2][j+1]==1)return true;
		else if(dt[i-1][j]==1 && dt[i][j+1]==1 && dt[i+1][j+1]==1)return true;
		else if(dt[i][j-1]==1 && dt[i-1][j-1]==1 && dt[i+1][j]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j-1]==1 && dt[i-2][j-1]==1)return true;
		else return false;
	}else return false;
}

bool checkG(int i,int j){
	if(dt[i][j]==1){
		if(dt[i][j+1]==1 && dt[i+1][j]==1 && dt[i+1][j-1]==1)return true;
		else if(dt[i][j-1]==1 && dt[i+1][j-1]==1 && dt[i+1][j-2]==1)return true;
		else if(dt[i-1][j]==1 && dt[i-1][j+1]==1 && dt[i][j-1]==1)return true;
		else if(dt[i][j+1]==1 && dt[i-1][j+1]==1 && dt[i-1][j+2]==1)return true;
		else return false;
	}else return false;
}

int main(){
	string ss;
	while(1){
		for(int i=0;i<24;i++){
			for(int j=0;j<24;j++){
				dt[i][j]=0;
			}
		}
		for(int i=8;i<16;i++){
			if(cin>>ss)break;
			for(int j=8;j<16;j++){
				dt[i][j]=ss[j-8]-'0';
			}
		}
		for(int a=8;a<16;a++){
			for(int b=8;b<16;b++){
				if(!num){
					if(checkA(a,b)){cout<<"A"<<endl;num++;}
					else if(checkB(a,b)){cout<<"B"<<endl;num++;}
					else if(checkC(a,b)){cout<<"C"<<endl;num++;}
					else if(checkD(a,b)){cout<<"D"<<endl;num++;}
					else if(checkE(a,b)){cout<<"E"<<endl;num++;}
					else if(checkF(a,b)){cout<<"F"<<endl;num++;}
					else if(checkG(a,b)){cout<<"G"<<endl;num++;}
				}
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
char n[12][12];
char figure[7][4][4] = {
	{"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"}
};

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])){
		for(int i=0; i<8; i++)
			for(int j=0; j<8; j++)
				cin >> n[i][j];

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

C++: #include <iostream>
#include <cstdio>

using namespace std;

int dx[7][3] = {1, 1, 0, 0, 0, 0, 1, 2, 3, 0, -1, -1, 1, 1, 2, 0, 1, 1, 1, 0, -1};
int dy[7][3] = {0, -1, -1, -1, -2, -3, 0, 0, 0, -1, -1, -2, 0, -1, -1, -1, -1, -2, 0, -1, -1};

char field[10][10];

int main()
{
  while (true) {
    for (int i = 0; i < 10; i++) {
      fill(field[i], &field[i][10], '0');
    }
    if (scanf("%c ", &field[1][1]) != 1) {break;}
    for (int i = 2; i < 9; i++) {
      scanf("%c ", &field[1][i]);
    }
    for (int i = 2; i < 9; i++) {
      for (int j = 1; j < 9; j++) {
	scanf("%c ", &field[i][j]);
      }
    }
    
    /*for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
	printf("%c ", field[i][j]);
      }
      printf("\n");
      }*/

    for (int i = 1; i <= 8; i++) {
      for (int j = 1; j <= 8; j++) {
	if (field[i][j] == '1') {
	  int c = 0;
	  for (c = 0; c < 7; c++) {
	    for (int k = 0; k < 3; k++) {
	      if (field[i - dy[c][k]][j + dx[c][k]] == '0') {goto next;}
	    }
	    printf("%c\n", 'A' + c);
	    goto end;
	  next:;
	  }
	}
      }
    }
  end:;
  }
}