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 <map>
#include <algorithm>
using namespace std;
typedef vector<int> vi;
#define repab(i,a,b) for(int i=a;i<b;i++)

int main(int argc, char **argv)
{
  const int margin = 3;
  const int field_size = 8;
  map<char, pair<vi, vi>> m;
  m['A'] = make_pair(vi({-1,  0, -1}), vi({ 0, -1, -1}));
  m['B'] = make_pair(vi({ 0,  0,  0}), vi({-1, -2, -3}));
  m['C'] = make_pair(vi({-1, -2, -3}), vi({ 0,  0,  0}));
  m['D'] = make_pair(vi({ 0,  1,  1}), vi({-1, -1, -2}));
  m['E'] = make_pair(vi({-1, -1, -2}), vi({ 0, -1, -1}));
  m['F'] = make_pair(vi({ 0, -1, -1}), vi({-1, -1, -2}));
  m['G'] = make_pair(vi({-1,  0,  1}), vi({ 0, -1, -1}));
  char c;
  int x, y;
  for (;;) {
    vector<vi> field(field_size+margin*2, vi(field_size+margin*2, 0));
    x = y = 0;
    repab (j, margin, field_size+margin) {
      repab (i, margin, field_size+margin) {
        cin.get(c);
        field[i][j] = c-'0';
        if (field[i][j]) {
          x = i;
          y = j;
        }
      }
      cin.get(c); // maybe '\n'
    }
    if (cin.eof())
      break;
    cin.get(c); // maybe '\n'

    for (char c = 'A'; c <= 'G'; c++) {
      vi& cordx = m[c].first;
      vi& cordy = m[c].second;
      if (field[x][y]
          && field[x+cordx[0]][y+cordy[0]]
          && field[x+cordx[1]][y+cordy[1]]
          && field[x+cordx[2]][y+cordy[2]]) {
        cout << c << endl;
        break;
      }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

char Types(char x[12][11]);

int main () {
    char x[100];
    for(int i=0; i<100; i++){
        x[i]='0';
    }
    int flag = 1;

    while(flag){

        for(int i=0; i<64; i++){
            cin>>x[i];
//            if(x[i]==EOF){
//                flag=0;
//                break;
//            }
        }
//        if(flag!=1){
//            break;
//        }
        
        int first=0;
        for(int i=0; i<64; i++){
            if(x[i]=='1'){
                first=i;
                break;
            }
        }
        if(first==0){
            break;
        }
        
        if(x[first+1]=='1'){
            if(x[first+2]=='1'){
                cout<<"C"<<endl;
            }else if(x[first+7]=='1'){
                cout<<"G"<<endl;
            }else if(x[first+10]=='1'){
                cout<<"E"<<endl;
            }else{
                cout<<"A"<<endl;
            }
        }else{
            if(x[first+7]=='1'){
                cout<<"D"<<endl;
            }else if(x[first+9]=='1'){
                cout<<"F"<<endl;
            }else{
                cout<<"B"<<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++)
		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", 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>

using namespace std;

const bool O = true, X = false;

const bool A[4] = {
    O, O,
    O, O
};

const bool B[4] = {
    O,
    O,
    O,
    O
};

const bool C[4] = {
    O, O, O, O
};

const bool D[6] = {
    X, O,
    O, O,
    O, X
};

const bool E[6] = {
    O, O, X,
    X, O, O
};

const bool F[6] = {
    O, X,
    O, O,
    X, O
};

const bool G[6] = {
    X, O, O,
    O, O, X
};

bool matched(const bool map[8][8], const bool* pattern, const int h, const int w) {
    for (int i = 0; i < 8 - h + 1; i++) {
        for (int j = 0; j < 8 - w + 1; j++) {
            bool unmatched = false;
            for (int a = 0; a < h; a++) {
                for (int b = 0; b < w; b++) {
                    if (map[i + a][j + b] != pattern[a * w + b]) {
                        unmatched = true;
                        break;
                    }
                }
            }
            if (!unmatched) return true;
        }
    }
    return false;
}

int main(void) {
    bool map[8][8];
    char c;
    while (true) {
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                cin >> c;
                map[i][j] = (c == '1');
            }
        }
        if (cin.eof()) break;
        cin.ignore();
        char p;
        if      (matched(map, A, 2, 2)) cout << "A" << endl;
        else if (matched(map, B, 4, 1)) cout << "B" << endl;
        else if (matched(map, C, 1, 4)) cout << "C" << endl;
        else if (matched(map, D, 3, 2)) cout << "D" << endl;
        else if (matched(map, E, 2, 3)) cout << "E" << endl;
        else if (matched(map, F, 3, 2)) cout << "F" << endl;
        else if (matched(map, G, 2, 3)) cout << "G" << endl;
    }
    return 0;
}