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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
char ta[12][12];
int main(){
while(cin>>ta[0][0]){
	int y,x;
	bool f=1;
	for(int i=0;i<8;i++){
		for(int j=(i==0);j<8;j++){
			char now;
			cin>>now;
			if(now=='1'&&f){y=i,x=j;f=0;}
			ta[i][j]=now;
		}
	}
	if(ta[y][x+1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x+1]=='1')cout<<"A";
	
	else if(ta[y+1][x]=='1'&&ta[y+2][x]=='1'&&ta[y+3][x]=='1')cout<<"B";
	
	else if(ta[y][x+1]=='1'&&ta[y][x+2]=='1'&&ta[y][x+3]=='1')cout<<"C";
	
	else if(ta[y][x+1]=='1'&&ta[y+1][x+1]=='1'&&ta[y+1][x+2]=='1')cout<<"E";
	
	else if(ta[y+1][x]=='1'&&ta[y+1][x+1]=='1'&&ta[y+2][x+1]=='1')cout<<"F";
	
	else if(ta[y][x+1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x-1]=='1')cout<<"G";
	
	else if(ta[y+2][x-1]=='1'&&ta[y+1][x]=='1'&&ta[y+1][x-1]=='1')cout<<"D";

	cout<<endl;
		for(int i=0;i<12;i++)for(int j=0;j<12;j++)ta[i][j]='0';
}
	
	return 0;
}

C++: #include <cstdio>
#define REP(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
char m[16][16], buf[16];
int main()
{
	while (true) {
		bool done = false;
		rep(i, 8) if (scanf("%s", m[i]) == EOF) done = true;
		if (done) break;

		char res = 0;
		rep(i, 8) rep(j, 8) {
			if (m[i][j] == '1') {
				if (j < 5 && m[i][j+1]=='1'&&m[i][j+2]=='1'&&m[i][j+3]=='1') {
					res = 'C';
				}
				else if (j < 7 && i < 7 && m[i][j+1]=='1'&&m[i+1][j]=='1'&&m[i+1][j+1]=='1') {
					res = 'A';
				}
				else if (i < 5 && m[i+1][j]=='1'&&m[i+2][j]=='1'&&m[i+3][j]=='1') {
					res = 'B';
				}
				else if (i < 6 && j > 0 && m[i+1][j-1]=='1'&&m[i+1][j]=='1'&&m[i+2][j-1]=='1') {
					res = 'D';
				}
				else if (i < 7 && j < 6 && m[i][j+1]=='1'&&m[i+1][j+1]=='1'&&m[i+1][j+2]=='1') {
					res = 'E';
				}
				else if (i < 6 && j < 7 && m[i+1][j+1]=='1'&&m[i+1][j]=='1'&&m[i+2][j+1]=='1') {
					res = 'F';
				}
				else if (i < 7 && j < 7 && j > 0 && m[i][j+1]=='1'&&m[i][j+1]=='1'&&m[i-1][j-1]=='1') {
					res = 'G';
				}
			}
			if (res > 0) goto BREAK;
		}
BREAK:
		printf("%c\n", res);
	}
	return 0;
}

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

double eps = 1e-10;

int main() {
	string s[16];
	while(cin >> s[0]){
		for(int i = 1; i < 8; ++i){
			cin >> s[i];
		}
		int h, w;
		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				if(s[i][j] == '1'){
					h = i;
					w = j;
					goto next;
				}
			}
		}
		next:;
		if(s[h + 1][w] == '1' && s[h][w + 1] == '1' && s[h + 1][w + 1] == '1'){
			cout << "A" << endl;
		}
		else if(s[h + 1][w] == '1' && s[h + 2][w] == '1' && s[h + 3][w] == '1'){
			cout << "B" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h][w + 2] == '1' && s[h][w + 3] == '1'){
			cout << "C" << endl;
		}
		else if(s[h + 1][w - 1] == '1' && s[h + 1][w] == '1' && s[h + 2][w - 1] == '1'){
			cout << "D" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h + 1][w + 1] == '1' && s[h + 1][w + 2] == '1'){
			cout << "E" << endl;
		}
		else if(s[h + 1][w] == '1' && s[h + 1][w + 1] == '1' && s[h + 2][w + 1] == '1'){
			cout << "F" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h + 1][h] == '1' && s[h + 1][w - 1] == '1'){
			cout << "G" << endl;
		}
	}
	return 0;
}

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

using namespace std;

string s[8];

int check( int i , int j ){

  if( i + 1 < 8 && j + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j] == '1' ){
      return 1;
    }
  }
  if( i + 3 < 8 ){
    if( s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1' ){
      return 2;
    }
  }
  if( j + 3 < 8 ){
    if( s[i][j+1] == '1' && s[i][j+2] == '1' && s[i][j+3] == '1' ){
      return 3;
    }
  }
 if( j - i >= 0 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j-1] == '1' && s[i+2][j-1] == '1' ){
      return 4;
    }
  }
 if( j + 2 < 8 && i + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1' ){
      return 5;
    }
  }
  if( j + 1 < 8 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1' ){
      return 6;
    }
  }
  return 7;
}

int main(void){
  
  while( cin >> s[0] ){

    for( int i = 1 ; i < 8 ; i++ ){
	cin >> s[i];
    }

    for( int i = 0 ; i < 8 ; i++ ){
      for( int j = 0 ; j < 8 ; j++ ){
	if( s[i][j] == '1' ){
	  // cout << check( i , j ) << "---" <<  endl;
	  switch( check( i , j ) ){
	  case 1:
	    cout << "A" << endl;
	    break;
	  case 2:
	    cout << "B" << endl;
	    break;
	  case 3:
	    cout << "C" << endl;
	    break;
	  case 4:
	    cout << "D" << endl;
	    break;
	  case 5:
	    cout << "E" << endl;
	    break;
	  case 6:
	    cout << "F" << endl;
	    break;
	  case 7:
	    cout << "G" << endl;
	    break;
	  }
	  goto end;
	}
      }
    }
   end:;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
using namespace std;

#define SIZE 8

int main() {
	string source[SIZE];
	while (true) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		if (cin.eof()) break;

		bool map[14][14] = {false};
		int x = SIZE - 1, y = SIZE - 1;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = (source[i][j] == '1' ? true : false);
				if (source[i][j] == '1') {
					x = min(j, x);
					y = min(i, y);
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "A";
		} 
		if (map[y + 1][x + 1] && map[y + 2][x + 1] && map[y + 1][x]) {
			cout << "F";
		}
		if (map[y + 1][x + 1] && map[y + 1][x + 2] && map[y][x + 1]) {
			cout << "E";
		}
		if (map[y - 1][x - 1] && map[y][x + 1] && map[y + 1][x]) {
			cout << "G";
		}
		if (map[y - 1][x - 1] && map[y + 2][x - 1] && map[y + 1][x]) {
			cout << "D";
		}
		if (map[y + 1][x] && map[y + 2][x] && map[y + 3][x]) {
			cout << "B";
		}
		if (map[y][x + 1] && map[y][x + 2] && map[y][x + 3]) {
			cout << "C";
		}
		cout << endl;
	}
	return 0;
}