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(), "")
		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<cstdio>
#include<iostream>
using namespace std;

int main(){

  char str[11][11];

  while( scanf("%s",str[0]) != EOF){
    
    int x=-1,y=-1;

    for(int j=0;j<8;j++){
      if(str[0][j]=='1'){
	x=j;
	y=0;
	break;
      }
    }
    
    for(int i=1;i<8;i++){
      scanf("%s",str[i]);
      if(x==-1 && y==-1){
	for(int j=0;j<8;j++){
	  if(str[i][j]=='1'){
	    x=j;
	    y=i;
	    break;
	  }
	}
      }
    }
    
    if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x+1]=='1') printf("A\n");
    else if(str[y+1][x]=='1' && str[y+2][x]=='1' && str[y+3][x]=='1') printf("B\n");
    else if(str[y][x+1]=='1' && str[y][x+2]=='1' && str[y][x+3]=='1') printf("C\n");
    else if(str[y+1][x]=='1' && str[y+1][x-1]=='1' && str[y+2][x-1]=='1') printf("D\n");
    else if(str[y][x+1]=='1' && str[y+1][x+1]=='1' && str[y+1][x+2]=='1') printf("E\n");
    else if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x-1]=='1') printf("F\n");
    else printf("G\n");
    
  }
  return 0;
    
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	int i, j, ctr1 = 0, ctr2 = 0;
	string s, ans;
	vector<string> ANS;
	bool B[8][8];

	while (1) {
		while (cin >> s) {
			for (i = 0; i < 8; i++) {
				B[ctr1][i] = stoi(s.substr(i, 1));
			}
			ctr1++; ctr2++;  if (ctr1 == 8)break;
		}

		for (i = 0; i < 7; i++) {//A
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j] == 1 && B[i + 1][j + 1] == 1)ans = 'A';
			}
		}

		for (i = 0; i < 5; i++) {//B
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i + 1][j] == 1 && B[i + 2][j] == 1 && B[i + 3][j] == 1)ans = 'B';
			}
		}

		for (i = 0; i < 7; i++) {//C
			for (j = 0; j < 5; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i][j + 2] == 1 && B[i][j + 3] == 1)ans = 'C';
			}
		}

		for (i = 0; i < 6; i++) {//D
			for (j = 1; j < 8; j++) {
				if (B[i][j] == 1 && B[i + 1][j - 1] == 1 && B[i + 1][j] == 1 && B[i + 2][j - 1] == 1)ans = 'D';
			}
		}

		for (i = 0; i < 7; i++) {//E
			for (j = 0; j < 6; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j + 1] == 1 && B[i + 1][j + 2] == 1)ans = 'E';
			}
		}

		for (i = 0; i < 6; i++) {//F
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i + 1][j] == 1 && B[i + 1][j + 1] == 1 && B[i + 2][j + 1] == 1)ans = 'F';
			}
		}

		for (i = 0; i < 7; i++) {//G
			for (j = 1; j < 7; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j - 1] == 1 && B[i + 1][j] == 1)ans = 'G';
			}
		}
		if (ctr2 == 0)break; ctr1 = 0;
		ANS.push_back(ans); ctr2 = 0;
	}
	for (i = 0; i < ANS.size(); i++)cout << ANS[i] << endl;
	return 0;
}

C++: #include<string>
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    char a[10][10];
    int x = 0;

    while(scanf("%s",a[x])!=EOF){
        if(x == 7){
            getchar();
            for(int i = 0;i < 8; i++){
                for(int j = 0;j < 8; j++){
                    if(a[i][j] == '1'&& a[i+1][j] == '1' && a[i][j+1] == '1' && a[i+1][j+1] == '1')printf("A\n");
                    if(a[i][j] == '1'&& a[i+1][j] == '1' && a[i+2][j] == '1' && a[i+3][j] == '1')printf("B\n");
                    if(a[i][j] == '1'&& a[i][j+1] == '1' && a[i][j+2] == '1' && a[i][j+3] == '1')printf("C\n");
                    if(a[i][j] == '1'&& a[i][j+1] == '1' && a[i-1][j+1] == '1' && a[i+1][j] == '1')printf("D\n");
                    if(a[i][j] == '1'&& a[i][j+1] == '1' && a[i+1][j+1] == '1' && a[i+1][j+2] == '1')printf("E\n");
                    if(a[i][j] == '1'&& a[i+1][j] == '1' && a[i+1][j+1] == '1' && a[i+2][j+1] == '1')printf("F\n");
                    if(a[i][j] == '1'&& a[i][j+1] == '1' && a[i-1][j+1] == '1' && a[i-1][j+2] == '1')printf("G\n");
                }
            }
            x = 0;
        }
        else {
            x++;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
char data[8][8];


struct P{
	P(){};
	P(int a,int b){
		x=a;
		y=b;
	}
	int x,y;
};

bool input(){
	for(int i=0;i<8;i++){
		if( scanf( "%s",data[i] ) == EOF )return false;
	}
	return true;
}
int main(){
	
	while(input()){
		P o=P(-1,-1);
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(data[i][j]=='1'){
					o=P(j,i);
					goto suc;
				}
			}
		}
		suc:;
		{
			for(int i=0;i<2;i++){
				for(int j=0;j<2;j++){
					if(o.y+i>=8 || o.x+j>=8)goto fail1;
					if(data[o.y+i][o.x+j]!='1')goto fail1;
				}
			}
			cout<<"A"<<endl;
			continue;
			fail1:;
		}
		{
			for(int i=0;i<4;i++){
				if(o.y+i>=8)goto fail2;
				if(data[o.y+i][o.x]!='1')goto fail2;
			}
			cout<<"B"<<endl;
			continue;
			fail2:; 
		}
		{
			for(int i=0;i<4;i++){
				if(o.x+i>=8)goto fail3;
				if(data[o.y][o.x+i]!='1')goto fail3;
			}
			cout<<"C"<<endl;
			continue;
			fail3:;
		}
		{
			if(o.y+2>=8 || o.x-1<=0)goto fail4;
			if(data[o.y+1][o.x]!='1')goto fail4;
			if(data[o.y+1][o.x-1]!='1')goto fail4;
			if(data[o.y+2][o.x-1]!='1')goto fail4;
			cout<<"D"<<endl;
			continue;
			fail4:;
		}
		{
			if(o.x+2>=8 || o.y+1>=8)goto fail5;
			if(data[o.y][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+2]!='1')goto fail5;
			cout<<"E"<<endl;
			continue;
			fail5:;
		}
		{
			if(o.x+1>=8 || o.y+2>=8)goto fail6;
			if(data[o.y+1][o.x]!='1')goto fail6;
			if(data[o.y+1][o.x+1]!='1')goto fail6;
			if(data[o.y+2][o.x+1]!='1')goto fail6;
			cout<<"F"<<endl;
			continue;
			fail6:;
		}
		{
			if(o.x!=-1)cout<<"G"<<endl;
		}
	}
}