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
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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 <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	char table[8][9];

	while(scanf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",table[0],table[1],table[2],table[3],table[4],table[5],table[6],table[7])!=EOF){

		bool FLG = false;
		for(int i=0; i < 8; i++){
			for(int k=0; k<8; k++){
				if(table[i][k] == '1'){
					if(i <= 6 && k <= 6 && table[i][k+1] == '1' && table[i+1][k] == '1' && table[i+1][k+1] == '1'){
						printf("A\n");
						FLG = true;
						break;
					}else if(i <= 4 && table[i+1][k] == '1' && table[i+2][k] == '1' && table[i+3][k] == '1'){
						printf("B\n");
						FLG = true;
						break;
					}else if(k <= 4 && table[i][k+1] == '1' && table[i][k+2] == '1' && table[i][k+3] == '1'){
						printf("C\n");
						FLG = true;
						break;
					}else if(i <= 5 && k >= 1 && table[i+1][k-1] == '1' && table[i+1][k] == '1' &&
							table[i+2][k-1] == '1'){
						printf("D\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 5 && table[i][k+1] == '1' && table[i+1][k+1] == '1' &&
							table[i+1][k+2] == '1'){
						printf("E\n");
						FLG = true;
						break;
					}else if(i <= 5 && k <= 6 && table[i+1][k] == '1' && table[i+1][k+1] == '1' &&
							table[i+2][k+1] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 6 && k >= 1 && table[i][k+1] == '1' && table[i+1][k-1] == '1' &&
							table[i+i][k] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}
				}
			}
			if(FLG)break;
		}
		getchar();
	}


	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<array>

using namespace std;

int main()
{
  array<array<int,8>,8> tbl;
  char c;
  
  while(true)
    {
      for ( auto i = 0; i < 8; ++i )
        for ( auto j = 0; j < 8; ++j )
          {
            if ( cin >> c )
              tbl[i][j] = c - '0';
            else
              return 0;
          }

      for ( auto i = 0; i < 8; ++i )
        for ( auto j = 0; j < 8; ++j )
          {
            if ( tbl[i][j] == 1 )
              {
                if ( tbl[i][j+1] == 1 && tbl[i+1][j] == 1 && tbl[i+1][j+1] == 1 )
                  cout << "A" <<endl;
                else if ( tbl[i+1][j] == 1 && tbl[i+2][j] == 1 && tbl[i+3][j] == 1)
                  cout << "B" << endl;
                else if ( tbl[i][j+1] == 1 && tbl[i][j+2] == 1 && tbl[i][j+3] == 1)
                  cout << "C" << endl;
                else if ( tbl[i+1][j] == 1 && tbl[i+1][j-1] == 1 && tbl[i+2][j-1] == 1)
                  cout << "D" << endl;
                else if ( tbl[i][j+1] == 1 && tbl[i+1][j+1] == 1 && tbl[i+1][j+2] == 1)
                  cout << "E" << endl;
                else if ( tbl[i+1][j] == 1 && tbl[i+1][j+1] == 1 && tbl[i+2][j+1] == 1)
                  cout << "F" << endl;
                else if ( tbl[i][j+1] == 1 && tbl[i+1][j-1] == 1 && tbl[i+1][j] == 1)
                  cout << "G" << endl;

                i = j = 8;
              }
          }
    }
  
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int a,i,j;
	char str[8];
	vector<int> s, memo;
	s.resize(64);
	while (true) {
		for (i = 0; i < 8; i++) {
			for (j = 0; j < 8; j++) {
				cin >> str[j];
				if (str[j] == '1') {
					a = 8 * i + j;
					memo.push_back(a);
				}
			}
		}
		if (cin.eof())break;
		if (memo[1] - memo[0] == 1) {
			if (memo[2] - memo[1] == 7) {
				cout << "A" << endl;
			}
			else if (memo[2] - memo[1] == 1) {
				cout << "C" << endl;
			}
			else if (memo[2] - memo[1] == 8) {
				cout << "E" << endl;
			}
			else if (memo[2] - memo[1] == 6) {
				cout << "G" << endl;
			}
		}
		else if (memo[1] - memo[0] == 8) {
			if (memo[2] - memo[1] == 8) {
				cout << "B" << endl;
			}
			else if (memo[2] - memo[1] == 1) {
				cout << "F" << endl;
			}
		}
		else if (memo[1] - memo[0] == 7) {
			cout << "D" << endl;
		}
		memo.clear();
	}
	return 0;
}

C++: #include <iostream>
#include <string.h>
#define MAX_LINE 8
using namespace std;
void searchString(string box);
int main() {
    int count = 0;
    char str[8];
    string box;
    while(cin >> str){
        box.append(str);
        count++;
        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");
    if (box.find(A) != string::npos) {
        cout << "A" << endl;
    }
    else if(box.find(B) != string::npos) {
        cout << "B" << endl;
    }
    else if(box.find(C) != string::npos) {
        cout << "C" << endl;
    }
    else if(box.find(D) != string::npos) {
        cout << "D" << endl;
    }
    else if(box.find(E) != string::npos) {
        cout << "E" << endl;
    }
    else if(box.find(F) != string::npos) {
        cout << "F" << endl;
    }
    else if(box.find(G) != string::npos) {
        cout << "G" << endl;
    }
}