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)
		fmt.Scanln()
	}
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        vector<string> s(8);
        for(int i=0; i<8; ++i){
            if(!(cin >> s[i]))
                return 0;
        }

        int dy[] = {3, 0, 2, 1, 2, 1};
        int dx[] = {0, 3, -1, 2, 1, -2};

        bool ok = false;
        for(int i=0; i<8; ++i){
            for(int j=0; j<8; ++j){
                if(ok || s[i][j] == '0')
                    continue;
                for(int k=0; k<6; ++k){
                    if(i+dy[k] < 8 && 0 <= j+dx[k] && j+dx[k] < 8 && s[i+dy[k]][j+dx[k]] == '1'){
                        cout << (char)('B' + k) << endl;
                        ok = true;
                        break;
                    }
                }
                if(!ok){
                    cout << 'A' << endl;
                    ok = true;
                }
            }
        }
    }
}

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

bool ok(int y,int x){
	if(y<0||x<0||y>7||x>7)return 0;
	if(ta[y][x]=='1')return 1;
	return 0;
}
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;
		}
	}
	//for(int i=0;i<8;i++){for(int j=0;j<8;j++){cout<<ta[i][j];}cout<<endl;}
	if( ok(y,x+1)&ok(y+1,x)&&ok(y+1,x+1) )cout<<"A";
	
	else if( ok(y+1,x)&&ok(y+2,x)&&ok(y+3,x) )cout<<"B";
	
	else if( ok(y,x+1)&&ok(y,x+2)&&ok(y,x+3) )cout<<"C";
	
	else if( ok(y,x+1)&ok(y+1,x+1)&&ok(y+1,x+2) )cout<<"E";
	
	else if( ok(y+1,x)&&ok(y+1,x+1) &&ok(y+2,x+1))cout<<"F";
	
	else if( ok(y,x+1)&&ok(y+1,x)&&ok(y+1,x-1) )cout<<"G";
	
	else if( ok(y+2,x-1)&&ok(y+1,x-1)&&ok(y+1,x))cout<<"D";

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

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    char m[15][15] = {'0'};
    bool check = true;
    while(check){
        range(i,4,12){
            if(cin >> m[i]){
                ;
            }else{
                check = false;
            }
        }
        range(i,4,12){
            range(j,0,8){
                if(m[i][j] == '1' && m[i+1][j] == '1' && m[i][j+1] == '1' && m[i+1][j+1] == '1'){
                     cout << 'A' << endl;
                      break;
                }
                if(m[i][j] == '1' && m[i+1][j] == '1' && m[i+2][j] == '1' && m[i+3][j] == '1'){
                     cout << 'B' << endl;
                      break;
                }
                if(m[i][j] == '1' && m[i][j+1] == '1' && m[i][j+2] == '1' && m[i][j+3] == '1'){
                     cout << 'C' << endl;
                      break;
                }
                if(m[i][j] == '1' && m[i+1][j] == '1' && m[i-1][j+1] == '1' && m[i-2][j+1] == '1'){
                     cout << 'D' << endl;
                      break;
                }
                if(m[i][j] == '1' && m[i][j+1] == '1' && m[i+1][j+1] == '1' && m[i+1][j+2] == '1'){
                     cout << 'E' << endl;
                      break;
                }
                if(m[i][j] == '1' && m[i+1][j] == '1' && m[i+1][j+1] == '1' && m[i+2][j+1] == '1'){
                     cout << 'F' << endl;
                      break;
                }
                if(m[i][j] == '1' && m[i][j+1] == '1' && m[i+1][j-1] == '1' && m[i+1][j] == '1'){
                     cout << 'G' << endl;
                      break;
                }
            }
        }
    }
}

C++: #include<stdio.h>

int main(){
char a[8][8];
int ans = 0;
while(1){
for(int i = 0; i < 8; i++){
if(scanf("%s",&a[i]) == EOF){
return 0;
}
}

for(int i = 0; i < 8; i++){
for(int j = 0; j < 8; j++){
if(a[i][j] == 1){
if(i < 7 && j < 7){
if(a[i+1][j] == 1 && a[i][j+1] == 1 && a[i+1][j+1] == 1){
printf("A\n");
}
}
if(i < 5){
if(a[i+1][j] == 1 && a[i+2][j] == 1 && a[i+3][j] == 1){
printf("B\n");
}
}
if(j < 5){
if(a[i][j+1] == 1 && a[i][j+2] == 1 && a[i][j+3] == 1){
printf("C\n");
}
}
if(i < 6 && j < 5){
if(a[i][j+1] == 1 && a[i+1][j+1] == 1 && a[i+1][j+2] == 1){
printf("E\n");
}
}
if(i < 5 && j < 6){
if(a[i+1][j] == 1 && a[i+1][j+1] == 1 && a[i+2][j+1] == 1){
printf("F\n");
}
}
if(j > 0 && i < 6){
if(a[i+1][j] == 1 && a[i+1][j-1] == 1 && a[i+2][j-1] == 1){
printf("D\n");
}
}
if(j > 0 && j < 7 && i < 7){
if(a[i+1][j] == 1 && a[i][j+1] == 1 && a[i+1][j-1] == 1){
printf("G\n");
}
}
}
}
}
}
}
return 0;
}