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 <array>
#include <string>

using namespace std;

constexpr size_t SIZE = 8;
constexpr size_t PATTERN = 6;

const array<string, PATTERN> pattern = {
    "110000001", "1000000010", "111", "10000001", "11000000", "10"};

string surface;

char choice();

int main()
{
    while (true) {
        surface = "";

        for (size_t row = 0; row < SIZE; row++) {
            string buf;
            cin >> buf;

            surface += buf;
        }

        cout << choice() << endl;

        cin.ignore(2);
        if (cin.eof()) {
            break;
        }
    }

    return 0;
}

char choice()
{
    for (size_t i = 0; i < PATTERN; i++) {
        if (surface.find(pattern.at(i)) != string::npos) {
            return static_cast<char>('A' + i);
        }
    }
    return 'G';
}

C++: #include<stdio.h>

int main()
{
	int a[8][8];
	while(scanf("%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d\n%d%d%d%d%d%d%d%d"
		,&a[0][0],&a[0][1],&a[0][2],&a[0][3],&a[0][4],&a[0][5],&a[0][6],&a[0][7]
	,&a[1][0],&a[1][1],&a[1][2],&a[1][3],&a[1][4],&a[1][5],&a[1][6],&a[1][7]
	,&a[2][0],&a[2][1],&a[2][2],&a[2][3],&a[2][4],&a[2][5],&a[2][6],&a[2][7]
	,&a[3][0],&a[3][1],&a[3][2],&a[3][3],&a[3][4],&a[3][5],&a[3][6],&a[3][7]
	,&a[4][0],&a[4][1],&a[4][2],&a[4][3],&a[4][4],&a[4][5],&a[4][6],&a[4][7]
	,&a[5][0],&a[5][1],&a[5][2],&a[5][3],&a[5][4],&a[5][5],&a[5][6],&a[5][7]
	,&a[6][0],&a[6][1],&a[6][2],&a[6][3],&a[6][4],&a[6][5],&a[6][6],&a[6][7]
	,&a[7][0],&a[7][1],&a[7][2],&a[7][3],&a[7][4],&a[7][5],&a[7][6],&a[7][7])!=EOF)
	{
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				if(a[x][y]==1)
				{
					if(a[x][y+1]==1)
					{
						if(a[x+1][y]==1)
						{
							if(a[x+1][y+1])
							{						
								printf("A\n");
							}
							else if(a[x+1][y-1])
							{
								printf("G\n");
							}
						}
						else if(a[x][y+2]==1&&a[x][y+3]==1)
						{
							printf("C\n");
						}
						else if(a[x+1][y+1]==1&&a[x+1][y+2]==1)
						{
							printf("E\n");
						}
					}
					else if(a[x+1][y]==1)
					{
						if(a[x+2][y]==1&&a[x+3][y]==1)
						{
							printf("B\n");
						}
						else if(a[x+1][y-1]==1&&a[x+2][y-1]==1)
						{
							printf("D\n");
						}
						else if(a[x+1][y+1]==1&&a[x+2][y+1]==1)
						{
							printf("F\n");
						}
					}
					x=10;
					y=10;
				}
			}
		}
	}
}

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

const int N=8,M=8;
char A[N][M];

int main()
{
	while(cin>>A[0]){
		for(int i=1;i<N;i++)
			cin >> A[i];
		int s,t;
		for(int i=N-1;i>=0;i--)
			for(int j=M-1;j>=0;j--)
				if(A[i][j]=='1'){
					s=i; t=j;
				}
				//A[s][t]=='1' && A[s][t]=='1' & A[s][t]=='1'
		if(A[s+1][t]=='1' && A[s][t+1]=='1' && A[s+1][t+1]=='1') cout << "A" <<endl;
		else if(A[s+1][t]=='1' && A[s+2][t]=='1' && A[s+3][t]=='1') cout <<"B" << endl;
		else if(A[s][t+1]=='1' && A[s][t+2]=='1' && A[s][t+3]=='1') cout <<"C"<<endl;
		else if(A[s+1][t]=='1' && A[s+1][t-1]=='1' && A[s+2][t-1]=='1') cout << "D" <<endl;
		else if(A[s][t+1]=='1' && A[s+1][t+1]=='1' && A[s+1][t+2]=='1') cout << "E" << endl;
		else if(A[s+1][t]=='1' && A[s+1][t+1]=='1' && A[s+2][t+1]=='1') cout << "F" << endl;
		else if(A[s][t+1]=='1' && A[s+1][t]=='1' && A[s+1][t-1]=='1') cout << "G" <<endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<string>
using namespace std;
char m[10][10];
int main(void){
  while(cin >> m[1][1]){
    for(int i=1;i<=8;i++){
      for(int j=1;j<=8;j++){
	if(i!=1 || j!=1)scanf(" %c",&m[i][j]);
      }
    }
    bool f=true;
    for(int i=1;i<=8 && f;i++){
      for(int j=1;j<=8 && f;j++){
	if(m[i][j]=='1'){
	  if(m[i+1][j]=='1' && m[i][j+1]=='1' && m[i+1][j+1]=='1'){
	    puts("A");
	    f=false;
	  }
	  else if(m[i+1][j]=='1' && m[i+2][j]=='1' && m[i+3][j]=='1'){
	    puts("B");
	    f=false;
	  }
	  else if(m[i][j+1]=='1' && m[i][j+2]=='1' && m[i][j+3]=='1'){
	    puts("C");
	    f=false;
	  }
	  else if(m[i+1][j]=='1' && m[i+1][j-1]=='1' && m[i+2][j-1]=='1'){
	    puts("D");
	    f=false;
	  }
	  else if(m[i][j+1]=='1' && m[i+1][j+1]=='1' && m[i+1][j+2]=='1'){
	    puts("E");
	    f=false;
	  }
	  else if(m[i+1][j]=='1' && m[i+1][j+1]=='1' && m[i+2][j+1]=='1'){
	    puts("F");
	    f=false;
	  }
	  else if(m[i][j+1]=='1' && m[i+1][j]=='1' && m[i+1][j-1]=='1'){
	    puts("G");
	    f=false;
	  }
	}
      }
    }
  }
}

C++: #include <iostream>
#include <cstdio>
#include <complex>

const int pattern_count = 7;
const int width = 8;
const int height = 8;

int pattern[pattern_count][3][2] = {
	{{1,0},{0,1},{1,1}},	// A
	{{0,1},{0,2},{0,3}},	// B
	{{1,0},{2,0},{3,0}},	// C
	{{-1,1},{0,1},{-1,2}},	// D
	{{1,0},{1,1},{2,1}},	// E
	{{0,1},{1,1},{1,2}},	// F
	{{1,0},{-1,1},{0,1}}	// G
};

bool read_data(char* cells)
{
	for (int i = 0; i < width * height; ++i) {
		std::cin >> cells[i];
	}
	return std::cin.good();
}

bool cell_marked(const char* cells, int x, int y)
{
	return (0 <= x && x < width && 0 <= y && y < height && cells[y * height + x] == '1');
}

bool matches(const char* cells, int kind)
{
	int first_mark = -1;
	for (int i = 0; i < width * height; ++i) {
		if (cells[i] == '1') {
			first_mark = i;
			break;
		}
	}
	if (first_mark < 0) {
		return false;
	}

	int x0 = first_mark % width;
	int y0 = first_mark / width;
	for (int i = 0; i < 3; ++i) {
		if (!cell_marked(cells, x0 + pattern[kind][i][0], y0 + pattern[kind][i][1])) {
			return false;
		}
	}
	return true;
}

int main()
{
	char cells[width * height + 1] = {};
	while (read_data(cells)) {
		for (int kind = 0; kind < pattern_count; ++kind) {
			if (matches(cells, kind)) {
				std::cout << static_cast<char>('A' + kind) << std::endl;
				break;
			}
		}
	}

	return 0;
}