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++: #include <iostream>
using namespace std;

#define MAX(X,Y) ((X)>(Y)?(X):(Y))
#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int main(void){
  string buf;
  string code="...B.AD..E..C";
  int brd[8][8];
  char ans;
  
  while (cin>>buf){
    int l=8,r=-1,t=8,b=-1, w, h;
    for (int i=0; i<8; i++){
      brd[i][0] = buf[i]-'0';
      if (brd[i][0]==1){
        l = MIN(i,l); r = MAX(i,r);
        t = MIN(0,t); b = MAX(0,b);
      }
    }
    for (int j=1; j<8; j++){
      cin >> buf;
      for (int i=0; i<8; i++){
        brd[i][j] = buf[i]-'0';
        if (brd[i][j]==1){
          l = MIN(i,l); r = MAX(i,r);
          t = MIN(j,t); b = MAX(j,b);
        }
      }
    }
    w = r-l+1; h = b-t+1;
    ans = code[((w-1)<<2)|(h-1)];
    if (ans=='D' && brd[l][t]==1) ans = 'F';
    if (ans=='E' && brd[l][t]==0) ans = 'G';
//    cout << l << " " << r << " " << t << " " << b << " ";
//    cout << w << " " << h << " ";
    cout << ans << endl;
  }

  return 0;
}

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

int main()
{
	int s[8], count, f;
	while(cin >> s[0]){
		count = 0;
		for (int i = 1; i < 8; i++){
			cin >> s[i];
		}

		for (int i = 0; i < 8; i++){
			if (s[i] > 0) count++;
		}
	
		if (count == 4) cout << "B" << endl;
		else if (count == 1) cout << "C" << endl;
		else if (count == 3) {
			for (int i = 0; i < 8; i++){
				if (s[i] > 0){
					if (s[i] < s[i + 2]) cout << "D" << endl;
					else cout << "F" << endl;
					i = 9;
				}
			}
		}
		else if (count == 2){
			for (int i = 0; i < 8; i++){
				if (s[i] > 0){
					if (s[i] == s[i + 1]) cout << "A" << endl;
					else if (s[i] > s[i + 1]) cout << "E" << endl;
					else cout << "G" << endl;
					i = 9;
				}
			}
		}
	}
	return (0);
}

C++: #include <iostream>

using namespace std;

class Point{
public:
	int x,y;
	Point(){}
	Point( int dx, int dy ) : x( dx ), y( dy ) {}
};

Point place[7][4] = { { Point( 0, 0 ), Point( 1, 0 ), Point( 0, 1 ), Point( 1, 1 ) },
	{ Point( 0, 0 ), Point( 0, 1 ), Point( 0, 2 ), Point( 0, 3 ) },
	{ Point( 0, 0 ), Point( 1, 0 ), Point( 2, 0 ), Point( 3, 0 ) },
	{ Point( 0, 0 ), Point( 0, 1 ), Point( -1, 1 ), Point( -1, 2 ) },
	{ Point( 0, 0 ), Point( 1, 0 ), Point( 1, 1 ), Point( 2, 1 ) },
	{ Point( 0, 0 ), Point( 0, 1 ), Point( 1, 1 ), Point( 1, 2 ) },
	{ Point( 0, 0 ), Point( 1, 0 ), Point( 0, 1 ), Point( -1, 1 ) } };

int main(int argc, char const* argv[])
{
	char data[10][10];

	while( true ){
		for( int i = 0;i < 10;i++ ){
			for( int j = 0;j < 10;j++ ){
				data[i][j] = 0;
			}
		}


		for( int i = 0;i < 8;i++ ){
			if( !( cin >> data[i] ) ) return 0;
		}

		int answer = 0;
		for( int i = 0;i < 8;i++ ){
			for( int j = 0;j < 8;j++ ){
				if( data[i][j] == '1' ){
					for( int k = 0;k < 7;k++ ){
						if( data[i + place[k][0].y][j + place[k][0].x] == '1' &&  data[i + place[k][1].y][j + place[k][1].x] == '1' && data[i + place[k][2].y][j + place[k][2].x] == '1' && data[i + place[k][3].y][j + place[k][3].x] == '1' ){
							answer = k;
							goto END;
						}
					}
				}
			}
		}
END:

		cout << static_cast<char>( 'A' + answer ) << endl;
	}


	return 0;
}

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

int main(){
	char p[7][19] = {"1100000011", "10000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011"};
	char f[65];
	char t;
	while(1 + scanf("%c", &t)){
		if(t == 10){
			scanf("%c", &t);
		}
		f[0] = t;
		for(int i = 1; i < 64; i++){
			scanf("%c", &t);
			if(t == 10){
				scanf("%c", &t);
			}
			f[i] = t;
		}
		f[64] = '\0';
		printf("%s", f);
		for(int i = 0; i < 7; i++){
			if(strstr(f, p[i])){
				printf("%c\n", i + 'A');
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

char S[8][9];

bool check(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4){
	if (S[y1][x1]=='1' && S[y2][x2]=='1' &&S[y3][x3]=='1' &&S[y4][x4]=='1'){
		return true;
	}
	return false;
}

int main(){
	while (scanf("%s",S[0])!=EOF){
		FOR(i,1,8){
			scanf("%s",S[i]);
		}
		REP(i,7){
			REP(j,7){
				if (check(i,j,i+1,j,i,j+1,i+1,j+1)){
					printf("A\n");
				}
			}
		}
		REP(i,8){
			REP(j,5){
				if (check(i,j,i,j+1,i,j+2,i,j+3)) printf("B\n");
			}
		}
		REP(i,5) REP(j,8) if (check(i,j,i+1,j,i+2,j,i+3,j)) printf("C\n");
		REP(i,7) REP(j,6) if (check(i+1,j,i,j+1,i+1,j+1,i,j+2)) printf("D\n");
		REP(i,6) REP(j,7) if (check(i,j,i+1,j,i+1,j+1,i+2,j+1)) printf("E\n");
		REP(i,7) REP(j,6) if (check(i,j,i,j+1,i+1,j+1,i+1,j+2)) printf("F\n");
		REP(i,6) REP(j,7) if (check(i+1,j,i+2,j,i,j+1,i+1,j+1)) printf("G\n");
	}
	return 0;
}

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

int ax[7] = {2, 1, 4, 2, 3, 2, 3};
int ay[7] = {2, 4, 1, 3, 2, 3, 2};
int a[7][4][4] = {
  {
    {1, 1},
    {1, 1},
  },
  {
    {1},
    {1},
    {1},
    {1},
  },
  {
    {1, 1, 1, 1},
  },
  {
    {0, 1},
    {1, 1},
    {1, 0},
  },
  {
    {1, 1, 0},
    {0, 1, 1},
  },
  {
    {1, 0},
    {1, 1},
    {0, 1},
  },
  {
    {0, 1, 1},
    {1, 1, 0},
  },
};

string p[8];
int main()
{
  char tmp;
  do
  {
    for(int i = 0; i < 8; i++)
      cin >> p[i];
    for(int i = 0; i < 7; i++)
    {
      for(int y = 0; y < 8 - ay[i] + 1; y++)
      {
        for(int x = 0; x < 8 - ax[i] + 1; x++)
        {
          for(int yy = 0; yy < ay[i]; yy++)
          {
            for(int xx = 0; xx < ax[i]; xx++)
            {
              if(p[y + yy][x + xx] - '0' != a[i][yy][xx])
                goto aaa;
            }
          }
          cout << (char)('A' + i) << endl;
          goto bbb;
aaa:;
        }
      }
    }
bbb:;
  } while(cin >> tmp);
}