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 <bits/stdc++.h>
using namespace std;

typedef complex<int> P;

namespace std{
	bool operator < (const P &a,const P &b){
		if( a.real() != b.real() ) return a.real() < b.real();
		return a.imag() < b.imag();
	}
	bool operator == (const P &a,const P &b){
		if( a.real() != b.real() ) return false;
		return a.imag() == b.imag();
	}
};

vector<vector<P>> ptn = {
	{P(0,0),P(1,1),P(1,0),P(0,1)},
	{P(0,0),P(0,2),P(0,1)},
	{P(0,0),P(1,0),P(2,0),P(3,0)},
	{P(1,0),P(1,1),P(0,1),P(0,2)},
	{P(0,0),P(1,0),P(1,1),P(2,1)},
	{P(0,0),P(0,1),P(1,1),P(1,2)},
	{P(1,0),P(2,0),P(0,1),P(1,1)}
};

string s[8];
int main(){
	while(true){
		for(int i = 0 ; i < 8 ; i++){
			if(!(cin >> s[i]))exit(0);
			
		}
		for(int i = 0 ; i < 7 ; i++)
			sort(ptn[i].begin(),ptn[i].end());
		for(int i = 0 ; i < 8 ; i++)
			for(int j = 0 ; j < 8 ; j++){
				vector<P> tmp;
				for(int y = 0 ; y < 8 ; y++)
					for(int x = 0 ; x < 8 ; x++){
						if( s[y][x] == '1'){
							tmp.push_back(P(x-j,y-i));
						}
					}
				sort(tmp.begin(),tmp.end());
				for(int k = 0 ; k < 7 ; k++){
					if( tmp == ptn[k] ){
						cout << (char)(k+'A') << endl;
					}
				}
			}
	}
					
					
	
	
}

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

char c[8][12];

int p;

int find(){
    int i = 0;
    while( c[i/8][i%8] == '0' ) i++;
    return i;
}

bool ex1(int d, int r){
    return c[p/8+d][p%8+r] == '1';
}

int main(){
    char dummy[4];
    while( true ){
        int i = 0;
        while( i < 8 && scanf("%s", c[i]) != EOF ){
            i++;
        }
        if( i < 8 ) break;
        p = find();
        if( ex1(0,1) && ex1(1,0) ){
             if( ex1(1,1) ) puts("A");
             else puts("G");
        }else if( ex1(2,0) ) puts("B");
        else if( ex1(0,2) ) puts("C");
        else if( ex1(1,0) ){
            if( ex1(1,1) ) puts("F");
            else puts("D");
        }else puts("E");
        fgets(dummy, 4, stdin);
    }
    return 0;
}

C++: #include <bits/stdc++.h>  

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

char s[10][10];

int main() {
	while(cin >> s[0]) {
		FOR(i, 1, 8) cin >> s[i];
		rep(i, 8) rep(j, 8) if(s[i][j] == '1') {
			if(s[i][j+1] == '1') {
				if(s[i+1][j] == '1' && s[i+1][j+1] == '1') {
					printf("A\n");
					goto end;
				}
				else if(s[i+1][j+1] == '1' && s[i+1][j+2] == '1') {
					printf("E\n");
					goto end;
				}
				else if(s[i][j+2] == '1' && s[i][j+3] == '1') {
					printf("C\n");
					goto end;
				}
				else{
					printf("G\n");
					goto end;
				}
			}
			else {
				if(s[i+1][j-1] == '1' && s[i+1][j] == '1' && s[i+2][j-1] == '1') {
					printf("D\n");
					goto end;
				} 
				else if(s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1') {
					printf("F\n");
					goto end;
				}
				else {
					printf("B\n");
					goto end;
				}
			}
		}
		end:;
	}
	return 0;
}

C++: #include <iostream>
int main(){
	int f = 0;
	while(1){
		std::string s[8];

		int x = 0,y = 0;
		for(int i=0;i<8;i++){
			std::cin >> s[i];
			if(std::cin.eof())f=1;
		}

		if(f)break;
		
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++)
				if(s[i][j] == '1' && !x && !y)x=j,y=i;
		}

		char res;
		if(y+1 < 8 && s[y+1][x] == '1'){
			if(x-1 >= 0 && s[y+1][x-1] == '1'){
				if(x+1 < 8 && s[y][x+1] == '1'){
					res = 'G';
				}
				else{
					res = 'D';
				}
			}
			else if(x+1 < 8 && s[y+1][x+1] == '1'){
				if(s[y][x+1] == '1'){
					res = 'A';
				}
				else{
					res = 'F';
				}
			}
			else{
				res = 'B';
			}
		}
		else{
			if(x+1 < 8 && s[y+1][x+1] == '1'){
				res = 'E';
			}
			else{
			res = 'C';
			}
		}

		std::cout << res << std::endl;
	}

	return 0;
}

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


int main(int argc,char* argv[]){
		std::string ans[7] ={"1100000011","1000000010000000100000001","1111","1000000110000001","11000000011","100000001100000001","110000011"};
		std::string alpha[7]={"A","B","C","D","E","F","G"};
		std::string prob[8];
		std::string problem;

		while(std::cin >> prob[0]){
						for(int a=1; a < 8; a++){
										std::cin >> prob[a];
						}
						for(int b=0; b < 8; b++){
										problem = problem + prob[b];
						}
						for(int c=0; c < 7; c++){
										std::string::size_type index = problem.find(ans[c]);
										if(index != std::string::npos){
														std::cout << alpha[c] << std::endl;
										}
						}
		}
}