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