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<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int main(){
	string s[7][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"
		}
	};
	
	const int N = 8;
	const int M = 4;
	string m[N];
	while(cin>>m[0]){
		reps(i,1,N)cin>>m[i];
		
		rep(i,N){
			rep(j,N){
				
				rep(c,7){
					bool ok = true;
					rep(k,M){
						rep(p,M){
							int x = j+p;
							int y = i+k;
							if(x>=N || y>=N){
								if(s[c][k][p]=='1')ok=false;
							}else{
								if(s[c][k][p]!=m[y][x])ok=false;
							}
						}
					}
					if(ok){
						printf("%c\n",'A'+c);
						goto A;
					}
				}
			}
		}
		A:;
	}
	
}

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

char mp[8][8];

void ans(char mp[8][8]){
    for(int i = 0 ; i < 8 ; i++){
        for(int j = 0 ; j < 8 ; j++){
            if(mp[i][j]=='1'){
                if(mp[i][j+1]=='1'&&mp[i+1][j]=='1'){
                    cout << 'A' << endl;
                    return;
                }
                else if(mp[i+3][j]=='1'){
                    cout << 'B' << endl;
                    return;
                }
                else if(mp[i][j+3]=='1'){
                    cout << 'C' << endl;
                    return;
                }
                else if(mp[i+2][j-1]=='1'){
                    cout << 'D' << endl;
                    return;
                }
                else if(mp[i+1][j+2]=='1'){
                    cout << 'E' << endl;
                    return;
                }
                else if(mp[i+2][j+1]=='1'){
                    cout << 'F' << endl;
                    return;
                }
                else{
                    cout << 'G' << endl;
                    return;
                }
            }
        }
    }
}

int main(){
    while(cin >> mp[0][0]){
        for(int i = 0 ; i < 8 ; i++){
            for(int j = 0 ; j < 8 ; j++){
                if(!i&&!j) continue;
                else cin >> mp[i][j];
            }
        }
        ans(mp);
    }
    
    return 0;
}

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int dx[7][4]={{0,0,1,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,-1,0,1}};
int dy[7][4]={{0,1,1,0},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,1,1,0}};
string MAP[8];
string ans="ABCDEFG";

int main(){
	while(1){
	for(int i=0; i<8; ++i){
		cin >> MAP[i];
		if(cin.eof()){
			return 0;
		}
	}
	for(int i=0; i<8; ++i){
		for(int j=0; j<8; ++j){
			if(MAP[i][j]=='1'){
				for(int k=0; k<7; ++k){
					bool ok=true;
					for(int l=0; l<4; ++l){
						int nx=j+dx[k][l];
						int ny=i+dy[k][l];
						if((0<=nx&&nx<8&&0<=ny&&ny<8&&MAP[ny][nx]!='1')||(nx<0||8<=nx||ny<0||8<=ny)){
							ok=false;
							break;
						}
					}
					if(ok){
						cout << ans[k] << "\n";
						break;
					}
				}
			}
		}
	}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  char m[8][8];
  while(cin>>m[0]){
    for(int i=1;i<8;i++) cin>>m[i];
    int p[4];
    int n=0;
    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	if(m[i][j]=='1') p[n++]=i*8+j;
      }
      if(n==4) break;
    }
    int x=p[1]+p[2]+p[3]-3*p[0];
    switch(x){
    case 18:
      cout<<"A";
      break;
    case 48:
      cout<<"B";
      break;
    case 6:
      cout<<"C";
      break;
    case 30:
      cout<<"D";
      break;
    case 20:
      cout<<"E";
      break;
    case 34:
      cout<<"F";
      break;
    case 16:
      cout<<"G";
      break;
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string.h>

#define MAX_LINE 8
#define MAXA_DATA 50

using namespace std;

// プロトタイプ宣言
void searchString(string box);

// main関数
int main() {
    int count = 0;
    int max = MAX_LINE * MAXA_DATA;
    char str[8];
    string box;
    for (int i=0; i<max; i++) {
        cin >> str;
        box.append(str);
        count++;
        // 8行ごとにチェック
        if(count%MAX_LINE == 0){
            searchString(box);
            box = "";
        }
    }
}

// 文字列チェック
void searchString(string box){
    string A("1100000011");
    string B("1000000010000000100000001");
    string C("1111");
    string D("1000000110000001");
    string E("11000000011");
    string F("100000001100000001");
    string G("110000011");
    // find関数は文字列がみつからなかったときにnposを返す
    if (box.find(A) != std::string::npos) {
        cout << "A" << endl;
    }
    else if(box.find(B) != std::string::npos) {
        cout << "B" << endl;
    }
    else if(box.find(C) != std::string::npos) {
        cout << "C" << endl;
    }
    else if(box.find(D) != std::string::npos) {
        cout << "D" << endl;
    }
    else if(box.find(E) != std::string::npos) {
        cout << "E" << endl;
    }
    else if(box.find(F) != std::string::npos) {
        cout << "F" << endl;
    }
    else if(box.find(G) != std::string::npos) {
        cout << "G" << endl;
    }
}