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 <cstdio>
using namespace std;

int main(){
	int ax, ay;
	char f[12][12];
	bool flag = false;

	for(int y=0 ; y<12 ; y++){
		for(int x=0 ; x<12 ; x++){
			f[y][x] = 0;
		}
	}

	while( 1 ){
		for(int i=0 ; i<8 ; i++) {
			if( scanf("%s", f[i]) == EOF ){
				flag = true;
				break;
			}
		}
		if(flag) break;

		for(int i=0 ; i<64 ; i++){
			if(f[i/8][i%8]=='1'){
				ax = i%8;
				ay = i/8;
				break;
			}
		}
		if( f[ay+1][ax]=='1' && f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' ){
			printf("A\n");
		}else if( f[ay+1][ax]=='1' && f[ay+2][ax]=='1' && f[ay+3][ax]=='1' ){
			printf("B\n");
		}else if( f[ay][ax+1]=='1' && f[ay][ax+2]=='1' && f[ay][ax+3]=='1' ){
			printf("C\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' && f[ay+1][ax+2]=='1' ){
			printf("E\n");
		}else if( f[ay+1][ax]=='1' && f[ay+1][ax+1]=='1' && f[ay+2][ax+1]=='1' ){
			printf("F\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("G\n");
		}else if( f[ay+2][ax-1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("D\n");
		}
	}
}

C++: #include <iostream>
#include <cstring>
using namespace std;
struct P {int x, y; char s[4][5];};
char f[8][9] = {{""}};
bool c(int x, int y, P p)
{
	int i, j;
	char t[8][9];
	for (i = 0; i < 8; i++)
		strcpy(t[i], f[i]);
	for (i = 0; i < p.y; i++)
	{
		for (j = 0; j < p.x; j++)
		{
			t[y+i][x+j] = p.s[i][j];
		}
	}
	for (i = 0; i < 8; i++)
		if (strcmp(t[i], f[i]) != 0)
		{
			return false;
		}
	return true;
}
int main()
{
	P p[7] = {2, 2, {"11", "11"},
		1, 4, {"1", "1", "1", "1"},
		4, 1, {"1111"},
		2, 3, {"01", "11", "10"},
		3, 2, {"110", "011"},
		2, 3, {"10", "11", "01"},
		3, 2, {"011", "110"}};
	int i, j, k;
	bool b;
	char res;
	while (!cin.eof())
	{
		for (i = 0; i < 8; i++)
			cin >> f[i];
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 8; j++)
			{
				for (k = 0; k < 7; k++)
				{
					if (8-j >= p[k].x && 8-i >= p[k].y)
						if (b = c(j, i, p[k]))
							res = 'A' + k;
				}
				if (b) break;
			}
			if (b) break;
		}
		cout << res << endl;
		cin.get();
	}
}

C++: #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int getPeace(string s, int& pos)
{
	int c = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s.substr(i, 1) == "1")
		{
			if (c == 0)
			{
				pos = i;
			}
			c++;
		}
	}
	return c;
}

int main()
{
	string s;
	string out = "";
	int p0 = -1;
	int pos0 = -1;
	for (int i = 0; cin >> s; )
	{
		int pos = -1;
		int p = getPeace(s, pos);

		if (out == "")
		{
			if (p == 4)
			{
				out = "C";
			}
			else if (p == 2)
			{
				if (p0 == 2)
				{
					if (pos == pos0)
					{
						out = "A";
					}
					else if (pos > pos0)
					{
						out = "E";
					}
					else
					{
						out = "G";
					}
				}
				else if (p0 == 1)
				{
					if (pos < pos0)
					{
						out = "D";
					}
					else if (pos == pos0)
					{
						out = "F";
					}
				}
			}
			else if (p == 1)
			{
				if (p0 == 1)
				{
					out = "B";
				}
			}
		}

		p0 = p;
		pos0 = pos;

		i++;
		if (i == 8)
		{
			i = 0;
			cout << out << endl;
			out = "";
			p0 = -1;
			pos0 = -1;
		}
	}

}

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

int main()
{
    std::string figure[] = {
        "1100000011",
        "1000000010000000100000001",
        "1111",
        "1000000110000001",
        "11000000011",
        "100000001100000001",
        "110000011"
    };

    while (!std::cin.eof()) {
        std::string s = "", tmp;
        for (int i = 0; i < 9; ++i) {
            getline(std::cin, tmp);
            s += tmp;
        }

        for (int i = 0; i < 7; ++i) {
            if (s.find(figure[i]) != std::string::npos) {
                std::cout << static_cast<char>(i + 'A') << std::endl;
                break;
            }
        }
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)

string kind = "ABCDEFG";

vector<vector<pair<int,int>>> fig = {
    {{ 1, 0}, { 0, 1}, { 1, 1}}, //A
    {{ 0, 1}, { 0, 2}, { 0, 3}}, //B
    {{ 1, 0}, { 2, 0}, { 3, 0}}, //C
    {{-1, 1}, { 0, 1}, {-1, 2}}, //D
    {{ 1, 0}, { 1, 1}, { 2, 1}}, //E
    {{ 0, 1}, { 1, 1}, { 1, 2}}, //F
    {{ 1, 0}, {-1, 1}, { 0, 1}}  //G
};

int main() {
    int v[8][8];
    while (1) {
        char c;
        rep(i,8) rep(j,8) {
            if ( ! (cin >> c)) return 0;
            v[i][j] = c - '0';
        }
        rep(i,8) rep(j,8) {
            if ( ! v[i][j]) continue;
            rep(k,(int)fig.size()) {
                bool ok = true;
                for (auto p : fig[k]) {
                    int x = j + p.first;
                    int y = i + p.second;
                    if (x < 0 || 8 <= x || y < 0 || 8 <= y || ! v[y][x]) {
                        ok = false;
                        break;
                    }
                }
                if (ok) {
                    cout << kind[k] << endl;
                }
            }
        }
    }
    return 0;
}

C++: //33
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(;;){
    char g[8][8];
    for(int y=0;y<8;y++){
      for(int x=0;x<8;x++){
	if(!(cin>>g[y][x]))return 0;
      }
    }
    for(int y=0;y<8;y++){
      for(int x=0;x<8;x++){
	if(g[y][x]=='1'){
	  int a=0;
	  for(int i=0;i<4;i++){
	    for(int j=0;j<4;j++){
	      a=(a<<1)+(y+i<8&&x+j<8&&g[y+i][x+j]=='1');
	    }
	  }
	  static const int f[]={0xcc00,0x8888,0xf000,0x4c80,0xc600,0x8c40,0x6c00};
	  cout<<char(find(f,f+7,a)-f+'A')<<endl;
	  goto next;
	}
      }
    }
  next:
    ;
  }
  return 0;
}