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)
		fmt.Scanln()
	}
}

C++: #include<stdio.h>
#include<string.h>
#include<stdlib.h>

void figure(char a[8][8])
{
  int i,j;
  for(i=0;i<8;i++)
    for(j=0;j<8;j++)
      if(a[i][j]=='1'){
	if(a[i][j+1]=='1'){
	  if(a[i+1][j]=='1' && a[i+1][j+1]=='1')
	    printf("A\n");
	  else if(a[i][j+2]=='1' && a[i][j+3]=='1')
	    printf("C\n");	
	  else if(a[i+1][j+1]=='1' && a[i+1][j+2]=='1')
	    printf("E\n");
	  else if(a[i+1][j]=='1' && a[i+1][j-1]=='1')
	    printf("G\n");
	}
	else if(a[i+1][j]=='1'){
	  if(a[i+2][j]=='1' && a[i+3][j]=='1')
	    printf("B\n");
	  else if(a[i+1][j-1]=='1' && a[i+2][j-1]=='1')
	    printf("D\n");
	  else if(a[i+1][j+1]=='1' && a[i+2][j+1]=='1')
	    printf("F\n");
	}
	goto OUT;
      }
 OUT:;
}

int main(void)
{
  char a[8][8];
  char *buf;
  int i,j,flag;
  while(1){
    for(i=0;i<8;i++){
      buf=malloc(sizeof(char)*9);
      if(fgets(buf,sizeof(char)*9,stdin)==NULL){
	goto OUT;
      }
      if(flag==1)break;
      // buf[8]='\0';
      for(j=0;j<8;j++)
	a[i][j]=buf[j];
      free(buf);
      //rewind(stdin);//これがないと変になる
    }
    figure(a);
   
  }
 OUT:
  return 0;
}

C++: #include <iostream>

using namespace std;

/** Problem0036 : A Figure on Surface **/
int main()
{
	char board[8][9];
	
	while (1) {
		for (int i=0; i<8; i++)
			cin.getline(board[i], 9, '\n');
		if (cin.eof()) break;
		
		for (int y=0; y<8; y++) {
			for (int x=0; x<8; x++) {
				if (board[y][x] == '1') {
					if (board[y][x+1] == '1' && board[y+1][x] == '1' && board[y+1][x+1] == '1')
						cout << "A" << endl;
					else if (board[y+1][x] == '1' && board[y+2][x] == '1' && board[y+3][x] == '1')
						cout << "B" << endl;
					else if (board[y][x+1] == '1' && board[y][x+2] == '1' && board[y][x+3] == '1')
						cout << "C" << endl;
					else if (board[y+1][x] == '1' && board[y+1][x-1] == '1' && board[y+2][x-1] == '1')
						cout << "D" << endl;
					else if (board[y][x+1] == '1' && board[y+1][x+1] == '1' && board[y+1][x+2] == '1')
						cout << "E" << endl;
					else if (board[y+1][x] == '1' && board[y+1][x+1] == '1' && board[y+2][x+1] == '1')
						cout << "F" << endl;
					else
						cout << "G" << endl;
					goto endloop;
				}
			}
		}
	endloop:
		;
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;

int A[7][4][4]={
  
  {
    {1,1,0,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
    {1,0,0,0},
  },
  
  {
    {1,1,1,1},
    {0,0,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,0,0},
    {1,1,0,0},
    {1,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,1,0,0},
    {0,1,1,0},
    {0,0,0,0},
    {0,0,0,0},
  },
  
  {
    {1,0,0,0},
    {1,1,0,0},
    {0,1,0,0},
    {0,0,0,0},
  },
  
  {
    {0,1,1,0},
    {1,1,0,0},
    {0,0,0,0},
    {0,0,0,0},
  },
},
  
  a[12][12];

string s="ABCDEFG";

bool check(int x, int y, int n){
  
  for(int k=0;k<4;k++){
    for(int l=0;l<4;l++){
      int nx=x+k,ny=y+l;
      if(A[n][k][l]==1){
	if(a[nx][ny]!=A[n][k][l]){
	  return false;
	}
	if(nx<0||nx>7||ny<0||ny>7){
	  return false;
	}
      }
    }
  }
  return true;
}


int main(void){

  char ch;

  while(true){

    for(int i=0;i<12;i++)
      for(int j=0;j<12;j++)
	a[i][j]=0;
    
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	cin.get(ch);
	if(cin.eof())return 0;
	a[i][j]=ch-'0';
      }
      cin.ignore();
    }
    bool fg=true;
    for(int k=0;fg && k<7;k++){
      for(int i=0;fg && i<8;i++){
	for(int j=0;fg && j<8;j++){
	  if(check(i,j,k)){
	    cout << s[k] << endl;
	    fg=false;
	  }
	}
      }
    }
  }

  return 0;
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
int main()
{
    char f[8][8];
    int x,y,i,j;
    while(1)
    {
        x=y=-1;
        for(i=0;i<8;i++)cin >> f[i];
        if(cin.eof())break;
        for(x=0;x<8;x++)
        {
            for(y=0;y<8;y++)
            {
                if(f[x][y]=='1')
                {
                    i=x;
                    j=y;
                    break;
                }
            }
            if(i==x&&j==y)break;
        }
        if(i<7&&j<7&&f[i+1][j]=='1'&&f[i][j+1]=='1'&&f[i+1][j+1]=='1')printf("A\n");
        else if(i<5&&f[i+3][j]=='1')printf("B\n");
        else if(j<5&&f[i][j+3]=='1')printf("C\n");
        else if(i<6&&j>0&&f[i+2][j-1]=='1')printf("D\n");
        else if(i<7&&j<6&&f[i+1][j+2]=='1')printf("E\n");
        else if(i<6&&j<7&&f[i+2][j+1]=='1')printf("F\n");
        else if(i<7&&j<7&&j>0&&f[i][j+1]=='1'&&f[i+1][j-1]=='1')printf("G\n");
    }
    return 0;
}

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

int main(){
	char n[12][12];
	char figure[7][4][4] = {
		{"1100","1100","0000","0000"},
		{"1000","1000","1000","1000"},
		{"1111","0000","0000","0000"},
		{"0100","1100","1000","0000"},
		{"1100","0110","0000","0000"},
		{"1000","1100","0100","0000"},
		{"0110","1100","0000","0000"}
	};

	for(int i=0; i<12; i++)
		for(int j=0; j<12; j++)
			n[i][j]='0';
	
	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n\n", n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])){
		for(int i=0; i<8; i++)
			for(int j=0; j<8; j++)
				cin >> n[i][j];

		for(int i=0; i<7; i++){
			for(int j=0; j<8; j++){
				for(int k=0; k<8; k++){
					bool flag=true;
					
					for(int x=0; x<4; x++){
						for(int y=0; y<4; y++){
							if(figure[i][x][y] != n[j+x][k+y]) flag = false;
						}
					}
					
					if(flag){
						cout << (char)('A'+i) << endl;
					}

				}
			}
		}
	}
	return 0;
}