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
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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 <algorithm>
#include <string>
using namespace std;

#define SIZE 8

int main() {
	string source[SIZE];
	while (true) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		if (cin.eof()) break;

		bool map[14][14] = {false};
		int x = SIZE - 1, y = SIZE - 1;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = (source[i][j] == '1' ? true : false);
				if (source[i][j] == '1') {
					x = min(j, x);
					y = min(i, y);
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "A";
		} 
		if (map[y + 1][x + 1] && map[y + 2][x + 1] && map[y + 1][x]) {
			cout << "F";
		}
		if (map[y + 1][x + 1] && map[y + 1][x + 2] && map[y][x + 1]) {
			cout << "E";
		}
		if (map[y - 1][x - 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "G";
		}
		if (map[y - 1][x - 1] && map[y + 2][x - 1] && map[y + 1][x]) {
			cout << "D";
		}
		if (map[y + 1][x] && map[y + 2][x] && map[y + 3][x]) {
			cout << "B";
		}
		if (map[y][x + 1] && map[y][x + 2] && map[y][x + 3]) {
			cout << "C";
		}
		cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const char dat[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" },
};

char f[16][16];

bool match(int k, int x, int y) {
    rep (i, 4) rep (j, 4) if (f[x+i][y+j] != dat[k][i][j]) return false;
    return true;
}

int solve() {
    rep (k, 7) rep (i, 8) rep (j, 8) if (match(k, i, j)) return k;
    return -1;
}

int main() {
    while (scanf(" %c", f[0]) != EOF) {
        rep (i, 8) rep (j, 8) if (i || j) scanf(" %c", f[i]+j);
        printf("%c\n", (char)('A'+solve()));
    }
    return 0;
}

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

int main(){

  string s[100];

  while(cin >> s[0]){
    for(int i=1;i<8;i++) cin >> s[i];
    cout << s[99][7] << endl;

    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	if(s[i][j] == '1'){

	  if(s[i][j+1] == '1'){
	    if(s[i][j+2] == '1') cout << "C" << endl;
	    else if(s[i+1][j-1] == '1') cout << "G" << endl;
	    else if(s[i+1][j] == '1') cout << "A" << endl;
	    else if(s[i+1][j+1] == '1') cout << "E" << endl;
	  }

	  else if(s[i+1][j] == '1'){
	    if(s[i+2][j+1] == '1') cout << "F" << endl;
	    else if(s[i+1][j-1] == '1') cout << "D" << endl;
	    else if(s[i+3][j] == '1') cout << "B" << endl;
	  }
	  i = 8;
	  j = 8;
	}

      }
    }
  }
}

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

#define SIZE 8

int main() {
	string source[SIZE];
	while (cin >> source[0]) {
		for (int i = 1; i < SIZE; i++) {
			cin >> source[i];
		}

		bool map[14][14] = {false}, f = true;
		int x = SIZE - 1, y = SIZE - 1;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = (source[i][j] == '1' ? true : false);
				if (source[i][j] == '1' && f) {
					x = j;
					y = i;
					f = false;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "A";
		} 
		if (map[y + 1][x + 1] && map[y + 2][x + 1] && map[y + 1][x]) {
			cout << "F";
		}
		if (map[y + 1][x + 1] && map[y + 1][x + 2] && map[y][x + 1]) {
			cout << "E";
		}
		if (map[y - 1][x - 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "G";
		}
		if (map[y - 1][x - 1] && map[y + 2][x - 1] && map[y + 1][x]) {
			cout << "D";
		}
		if (map[y + 1][x] && map[y + 2][x] && map[y + 3][x]) {
			cout << "B";
		}
		if (map[y][x + 1] && map[y][x + 2] && map[y][x + 3]) {
			cout << "C";
		}
		cout << endl;
	}
	return 0;
}

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