Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    enum blocks{
        A = 18, B = 48, C = 6, D = 30, E = 20, F = 34, G = 16
    };
    string surface, input;
    while(cin >> surface){
        rep(i,7){
            cin >> input;
            surface+= input;
        }
        int first = -1, location = 0;
        rep(i,65){
            if(surface[i] == '1' && first == -1){
                first = i;
            }else if(surface[i] == '1'){
                location+= i - first;
            }
        }
        if(A == location) cout << 'A' << endl;
        else if(B == location) cout << 'B' << endl;
        else if(C == location) cout << 'C' << endl;
        else if(D == location) cout << 'D' << endl;
        else if(E == location) cout << 'E' << endl;
        else if(F == location) cout << 'F' << endl;
        else if(G == location) cout << 'G' << endl;
    }
}

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