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

C++: import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	class B{
		int[][] a;
		String name;

		B(int[][] a, String name){
			this.a=a;
			this.name=name;
		}
	}

	int[][] A={{1, 1}, {1, 1}};
	int[][] B={{1}, {1}, {1}, {1}};
	int[][] C={{1, 1, 1, 1}};
	int[][] D={{0, 1}, {1, 1}, {1, 0}};
	int[][] E={{1, 1, 0}, {0, 1, 1}};
	int[][] F={{1, 0}, {1, 1}, {0, 1}};
	int[][] G={{0, 1, 1}, {1, 1, 0}};

	int[][] field;

	int n=8;

	void run(){
		LinkedList<B> blocks=new LinkedList<B>();
		blocks.add(new B(A, "A"));
		blocks.add(new B(B, "B"));
		blocks.add(new B(C, "C"));
		blocks.add(new B(D, "D"));
		blocks.add(new B(E, "E"));
		blocks.add(new B(F, "F"));
		blocks.add(new B(G, "G"));

		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			field=new int[n][n];
			for(int j=0; j<n; j++){
				String s=sc.nextLine();
				for(int i=0; i<n; i++){
					if(s.charAt(i)=='0')
						field[j][i]=0;
					else
						field[j][i]=1;
				}
			}
			boolean f=false;
			for(int j=0; j<n; j++){
				for(int i=0; i<n; i++){
					for(B b : blocks){
						if(match(b, i, j)){
							println(b.name);
							f=true;
							break;
						}
					}
					if(f)
						break;
				}
				if(f)
					break;
			}

			sc.nextLine();
		}
		sc.close();
	}

	boolean match(B b, int x, int y){
		int[][] a=b.a;
		for(int j=0; j<a.length; j++){
			for(int i=0; i<a[0].length; i++){
				int x2=x+i;
				int y2=y+j;
				if(x2<0||x2>=n||y2<0||y2>=n)
					return false;
				if(a[j][i]==1&&field[y2][x2]==0)
					return false;
			}
		}
		return true;
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

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, y = SIZE;
		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 (map[i + 3][j + 3] && 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<bits/stdc++.h>
using namespace std;
char str[9][9];
int mx[4]={1,0,-1,0},my[4]={0,1,0,-1},moving[4];
void serch(int mo,int y,int x)
{
    for(int i=0;i<4;i++){
            if(str[my[i]+y][x+mx[i]]=='1'&&my[i]+y>=0&&my[i]+y<9&&mx[i]+x>=0&&mx[i]+x<9){
                str[my[i]+y][x+mx[i]]='0';
                moving[mo]=i;
                serch(mo+1,y+my[i],x+mx[i]);
                break;
            }

    }
}
int main()
{
    int co=0;
    while(cin>>str[0]){
        for(int i=1;i<8;i++)cin>>str[i];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(str[i][j]=='1'&&co==1)co++;
                else if(str[i][j]=='1'&&co==0){
                    str[i][j]='0';
                    serch(0,i,j);
                    co++;
                }

            }
        }
        if(moving[0]==0&&co!=2){
            if(moving[1]==1){
                if(moving[2]==2)cout<<"A"<<endl;
                else cout<<"E"<<endl;
            }
            else cout<<"C"<<endl;
        }
        else if(moving[0]==1&&co!=2){
            if(moving[1]==0)cout<<"F"<<endl;
            else if(moving[1]==1)cout<<"B"<<endl;
            else if(moving[1]==2)cout<<"D"<<endl;
        }
        else cout<<"G"<<endl;
        co=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:;
  }
}