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>
int main(){
	std::string s[8];
	int f = 0;
	while(1){
		if(f)std::cout << "\n";
		else f = 1;

		int x = 0,y = 0;
		for(int i=0;i<8;i++){
			std::cin >> s[i];
			if(std::cin.eof())return 0;
			for(int j=0;j<8;j++)
				if(s[i][j] == '1' && !x && !y)x=j,y=i;
		}
		
		char res;
		if(y+1 < 8 && s[y+1][x] == '1'){
			if(x-1 >= 0 && s[y+1][x-1] == '1'){
				if(x+1 < 8 && s[y][x+1] == '1'){
					res = 'G';
				}
				else{
					res = 'D';
				}
			}
			else if(x+1 < 8 && s[y+1][x+1] == '1'){
				if(s[y][x+1] == '1'){
					res = 'A';
				}
				else{
					res = 'F';
				}
			}
			else{
				res = 'B';
			}
		}
		else{
			if(x+1 < 8 && s[y+1][x+1] == '1'){
				res = 'E';
			}
			else{
			res = 'C';
			}
		}

		std::cout << res << std::endl;
	}
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
char s[100][100];
int main(){
	

	while(cin>>s[1][1]){
		string a;
		for(int j=2;j<8;j++){
			cin>>s[1][j];
		}
		for(int i=2;i<=8;i++){
			for(int j=1;j<=8;j++){
				cin>>s[i][j];
			}
		}
		for(int y=1;y<=8;y++){
			for(int x=1;x<=8;x++){
		if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1')
			cout<<"A"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+2][x]=='1'&&s[y+3][x]=='1')
			cout<<"B"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y][x+2]=='1'&&s[y][x+3]=='1')
			cout<<"C"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1'&&s[y+2][x-1]=='1')
			cout<<"D"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1'&&s[y+1][x+2]=='1')
			cout<<"E"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x+1]=='1'&&s[y+2][x+1]=='1')
			cout<<"F"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1')
			cout<<"G"<<endl;
			}
		}
	}
}

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

bool map[8][8];

char Solve(int x,int y){

  if(x!=7 && map[y][x+1]==1 && y!=7 && map[y+1][x]==1 && map[y+1][x+1]==1)
    return 'A';

  else if(y<=4&&map[y+1][x]==1&&map[y+2][x]==1&&map[y+3][x]==1)
    return 'B';

  else if(x<=4&&map[y][x+1]==1&&map[y][x+2]==1&&map[y][x+3]==1)
    return 'C';

  else if(x>0&&y<=5&&map[y-1][x]==1&&map[y-1][x-1]==1&&map[y-2][x-1]==1)
    return 'D';

  else if(y<7&&x<=5&&map[y][x+1]==1&&map[y+1][x+1]==1&&map[y+1][x+2]==1)
    return 'E';

  else if(x<7&&y<=5&&map[y-1][x]==1&&map[y-1][x+1]==1&&map[y-2][x+1]==1)
    return 'F';

  else
    return 'G';

}

int main(){

  char c;

  while(cin>>c){

    map[0][0]=c-'0';

    for(int i=1; i<8; i++){cin>>c;map[0][i]=c-'0';}
    for(int i=1; i<8; i++)for(int j=0; j<8; j++){cin>>c;map[i][j]=c-'0';}

    int i,j;
    for(i=0; i<8; i++){
      for(j=0; j<8; j++){
        if(map[i][j]==true)goto BREAK;
      }
    }
    BREAK:;

  //  for(int m=0;m<8;m++){for(int n=0;n<8;n++)cout<<map[m][n];cout<<endl;}

    cout << Solve(j,i) << endl;

    getchar();

  }


  return 0;

}

C++: #include <iostream>

#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

int main() {

	char a, c;
	int map[10][10];

	while(cin >> c) {
		if(c == '0' || c== '1') {
			rep(i,10)rep(j,10)
				map[i][j] = 0;

			rep(i,8)rep(j,8) {
				if(!(i == 0 && j == 0)) cin >> c;
				map[i][j] = (int)c - '0';
			}

			rep(i,8)rep(j,8) {
				if(map[i][j]) {
					if(map[i][j+2])   a = 'C';
					if(map[i+2][j])   a = 'B';
					if(map[i+1][j+1]) a = 'A';
					if(map[i+1][j-1]) a = 'G';
					if(map[i+1][j+2]) a = 'E';
					if(map[i+2][j+1]) a = 'F';
					if(map[i+2][j-1]) a = 'D';
					break;
				}
			}

			cout << a << endl;
		}
	}

	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;
		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:;
		}
		{
			cout<<"G"<<endl;
		}
	}
}