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 <cstdlib>
using namespace std;
int field[12][12];

char search(int y,int x) {
  if(field[y][x+1] == 1) { //A
    if(field[y][x+2] == 1) {
      return 'C';
    }
    if(field[y+1][x] == 1&&field[y+1][x+1] == 1) {
      return 'A';
    }
    if(field[y+1][x] == 1&&field[y+1][x-1] == 1) {
      return 'G';
    }
    if(field[y+1][x+1] == 1&&field[y+1][x+2] == 1) {
      return 'E';
    }
  }
  if(field[y+2][x] == 1) {
    return 'B';
  }
  if(field[y+1][x-1] == 1) {
    return 'D';
  }
  if(field[y+2][x+1] == 1) {
    return 'F';
  }
  return 'X';
}

void solve() {
  for(int i=0;i<8;i++) {
    for(int j=0;j<8;j++) {
      if(field[i+1][j+1] != 0) {
        cout << search(i+1,j+1) << endl;
        return;
      }
    }
  }
}

int main() {
  string str;
  while(1) {
    for(int i=0;i<8;i++) {
      getline(cin,str);
      if(str.size() == 0) return 0;
      for(int j=0;j<8;j++) {
        field[i+1][j+1] = atoi(str.substr(j,1).c_str());
      }
    }
    solve();
    getline(cin,str); //kill \n
  }
}

C++: #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'&&map[i+32]=='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;
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

char a[16][16];

bool is1(int i,int j){
	return i >= 0 && i < 8 && j >= 0 && j < 8 && a[i][j] == '1';
}

int main(){
	while(1){
start:
		for(int i = 0; i < 8;i++){
			if(scanf("%s",a[i]) != 1){
				return 0;
			}
		}

		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(a[i][j] == '1'){
					if(is1(i,j+1) && is1(i+1,j) && is1(i+1,j+1)){
						puts("A");
					}
					else if (is1(i+1,j) && is1(i+2,j) && is1(i+3,j)){
						puts("B");
					}
					else if(is1(i,j+1) && is1(i,j+2) && is1(i,j+3)){
						puts("C");
					}
					else if(is1(i+1,j-1) && is1(i+1,j) && is1(i+2,j-1)){
						puts("D");
					}
					else if(is1(i,j+1) && is1(i+1,j+1) && is1(i+1,j+2)){
						puts("E");
					}
					else if(is1(i+1,j) && is1(i+1,j+1) && is1(i+2,j+1)){
						puts("F");
					}
					else if(is1(i,j+1) && is1(i+1,j-1) && is1(i+1,j)){
						puts("G");
					}

					goto start;	
				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	while(1){
		int b[8][8]={0};
		string str;
		for(int i=0;i<8;i++){
			cin>>str;
			for(int j=0;j<8;j++){
				b[i][j]=str[j]-48;
			}
		}
		int x;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(b[i][j] && b[i+1][j] && b[i][j+1] && b[i+1][j+1]) x=1;
				else if(b[i][j] && b[i+1][j] && b[i+2][j] && b[i+3][j]) x=2;
				else if(b[i][j] && b[i][j+1] && b[i][j+2] && b[i][j+3]) x=3;
				else if(b[i][j] && b[i+1][j] && b[i+1][j-1] && b[i+2][j-1]) x=4;
				else if(b[i][j] && b[i][j+1] && b[i+1][j+1] && b[i+1][j+2]) x=5;
				else if(b[i][j] && b[i+1][j] && b[i+1][j+1] && b[i+2][j+1]) x=6;
				else if(b[i][j] && b[i][j+1] && b[i+1][j] && b[i+1][j-1]) x=7;
			}
		}
		switch(x){
		case 1:
			cout<<"A"<<endl;
			break;
		case 2:
			cout<<"B"<<endl;
			break;
		case 3:
			cout<<"C"<<endl;
			break;
		case 4:
			cout<<"D"<<endl;
			break;
		case 5:
			cout<<"E"<<endl;
			break;
		case 6:
			cout<<"F"<<endl;
			break;
		case 7:
			cout<<"G"<<endl;
			break;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
string match(const vector<string> v){
	const string PTN[7][4]{
		{"11","11"},
		{"1","1","1","1"},
		{"1111"},
		{"01","11","10"},
		{"110","011"},
		{"10","11","01"},
		{"011","110"}
	};
	const int PTN_H[7]{2,4,1,3,2,3,2};
	const string PTN_NAME[7]={"A","B","C","D","E","F","G"};
	int ans=-1;
	for(int k=0;k<7;++k){
		int pw=PTN[k][0].size(),ph=PTN_H[k];
		for(int i=0;i<8;++i){
			for(int j=0;j<8;++j){
				if(i+ph<8&&j+pw<8){
					bool f=true;
					for(int l=0;l<ph;++l){
						if(PTN[k][l]!=v[i+l].substr(j,pw))f=false;
					}
					if(f){ans=k;break;break;break;}
				}else{
					break;
				}
			}
		}
	}
	return PTN_NAME[ans];
}
int main(){
	for(;;){
		vector<string> surface;
		for(int i=0;i<8;++i){
			string s;
			getline(cin,s);
			if(s.empty())return 0;
			surface.push_back(s);
		}
		string ans = match(surface);
		cout<<ans<<endl;
		cin.ignore();
	}
	return 0;
}