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>
#include <cstdio>
#include <complex>

const int pattern_count = 7;
const int width = 8;
const int height = 8;

int pattern[pattern_count][3][2] = {
	{{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
};

bool read_data(char* cells)
{
	for (int i = 0; i < width * height; ++i) {
		std::cin >> cells[i];
	}
	return std::cin.good();
}

bool cell_marked(const char* cells, int x, int y)
{
	return (0 <= x && x < width && 0 <= y && y < height && cells[y * height + x] == '1');
}

bool matches(const char* cells, int kind)
{
	int first_mark = -1;
	for (int i = 0; i < width * height; ++i) {
		if (cells[i] == '1') {
			first_mark = i;
			break;
		}
	}
	if (first_mark < 0) {
		return false;
	}

	int x0 = first_mark % width;
	int y0 = first_mark / width;
	for (int i = 0; i < 3; ++i) {
		if (!cell_marked(cells, x0 + pattern[kind][i][0], y0 + pattern[kind][i][1])) {
			return false;
		}
	}
	return true;
}

int main()
{
	char cells[width * height + 1] = {};
	while (read_data(cells)) {
		for (int kind = 0; kind < pattern_count; ++kind) {
			if (matches(cells, kind)) {
				std::cout << static_cast<char>('A' + kind) << std::endl;
				break;
			}
		}
	}

	return 0;
}

C++: #include<bits/c++std.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<math.h>
#include<bitset>
using namespace std;
int main(){
	int a,b;
	char map[64];
	int movex[4]={1,0,-1,0},movey[4]={0,1,0,-1};
	while(cin>>map[0]){
		for(int i=1;i<64;i++){
			cin>>map[i];
		}
		int i,j;
		for(i=0;i<64;i++){
			if(map[i]=='1'){
				break;
			}
		}
		if(map[i+1]=='1'){
			if(map[i+8]=='1'&&map[i+9]=='1'){
				cout<<"A"<<endl;
			}
			else if(map[i+2]=='1'&&map[i+3]=='1'){
				cout<<"C"<<endl;
			}
			else if(map[i+9]=='1'&&map[i+10]=='1'){
				cout<<"E"<<endl;
			}
			else if(map[i+7]=='1'&&map[i+8]=='1'){
				cout<<"G"<<endl;
			}
		}
		else if(map[i+8]=='1'){
			if(map[i+16]=='1'&&map[i+24]=='1'){
				cout<<"B"<<endl;
			}
			else if(map[i+7]=='1'&&map[i+15]){
				cout<<"D"<<endl;
			}
			else if(map[i+9]=='1'&&map[i+17]=='1'){
				cout<<"F"<<endl;
			}
		}
		memset(map,'0',sizeof(map));
	}
	return 0;
}

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

int main(){
	string line[8];



	int w = 0, h = 0, t=-1;

	for(int i=0;i<8;++i)
		cin >> line[i];

	int right=0,left=7;

	for(int i=0;i<8;++i){
		bool exist = false;
		for(int j=0;j<8;++j){
			if((line[i])[j] == '1'){
				if(t!=-1)t=i;
				if(j>right)right = j;
				if(j<left)left = j;
				exist = true;
			}
		}
		if(exist)++h;
	}
	w = right - left + 1;

	if( w == 2 && h == 2 )cout<<"A"<<endl;
	else if(w == 1)cout<<"B"<<endl;
	else if(h == 1)cout<<"C"<<endl;


	else if(w==2){
		for(int i=0;i<8;++i){
			if((line[i])[left] == '1'){
				if((line[i])[left+1]=='1')
					cout<<"D"<<endl;
				else
					cout<<"F"<<endl;
				break;
			}
		}
	}

	else if(h==2){
		for(int i=0;i<8;++i){
			if((line[t])[i]=='1'){
				if((line[t+1])[i]=='1')
					cout<<"G"<<endl;
				else
					cout<<"E"<<endl;
			}
		}
	}
	return 0;
}

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

char get_type(string d[]) {
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (d[i][j] == '1') {
        if (i + 3 < 8 && d[i + 3][j] == '1') return 'B';
        if (j + 3 < 8 && d[i][j + 3] == '1') return 'C';
        if (i + 2 < 8 && j - 1 >= 0 && d[i + 2][j - 1] == '1') return 'D';
        if (i + 2 < 8 && j + 1 < 8 && d[i + 2][j + 1] == '1') return 'F';
        if (i + 1 < 8 && j + 2 && d[i + 1][j + 2] == '1') return 'E';
        if (i + 1 < 8 && j + 1 && d[i + 1][j + 1] == '1') return 'A';
        return 'G';
      }
    }
  }
  return '-';
}

int main() {
  string d[8];
  while (getline(cin, d[0])) {
    for (int i = 1; i < 8; i++) {
      getline(cin, d[i]);
    }
    cout << get_type(d) << endl;
    getline(cin, d[0]);
  }
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
bool pos(int x,int y){
  return 0<=x&&x<8&&0<=y&&y<8;
}
int main(){
  string in;
  int fld[8][8];
  while(cin>>in){
    for(int i=0;i<8;i++)fld[i][0]=in[i]-'0';
    for(int i=1;i<8;i++){
      cin>>in;
      for(int j=0;j<8;j++){
        fld[j][i]=in[j]-'0';
      }
    }
    char ans='.';
    for(int x=0;x<8;x++){
      if(ans!='.')break;
      for(int y=0;y<8;y++){
        if(ans!='.')break;
        if(fld[x][y]){
          if(fld[x+1][y]&&pos(x+1,y)){
            if(fld[x][y+1]&&pos(x,y+1)){
              if(fld[x+1][y+1]&&pos(x+1,y+1))ans='A';
              if(fld[x-1][y+1]&&pos(x-1,y+1))ans='G';
            }
            if(fld[x+2][y]&&fld[x+3][y]&&pos(x+2,y)&&pos(x+3,y))ans='C';
            if(fld[x+1][y+1]&&fld[x+2][y+1]&&pos(x+1,y+1)&&pos(x+2,y+1))ans='E';
          }else if(fld[x][y+1]&&pos(x,y+1)){
            if(fld[x][y+2]&&pos(x,y+2))ans='B';
            if(fld[x-1][y+1]&&pos(x-1,y+2))ans='D';
            else ans='F';
          }
        }
      }
    }
    cout<<ans<<endl;
  }
}