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(), "")
		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<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;
  }
}

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