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>
using namespace std;

int main(){
    char mas[8][8];
    while(1){
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                cin >> mas[i][j];
            }
        }
        if(cin.eof()) break;
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(mas[i][j] == '1'){
                    if(mas[i+1][j]=='1'&&mas[i][j+1]=='1'&&mas[i+1][j+1]=='1') cout << "A" << endl;
                    else if(mas[i+1][j]=='1'&&mas[i+2][j]=='1'&&mas[i+3][j]=='1') cout << "B" << endl;
                    else if(mas[i][j+1]=='1'&&mas[i][j+2]=='1'&&mas[i][j+3]=='1') cout << "C" << endl;
                    else if(mas[i+1][j]=='1'&&mas[i+1][j-1]=='1'&&mas[i+2][j-1]=='1') cout << "D" << endl;
                    else if(mas[i][j+1]=='1'&&mas[i+1][j+1]=='1'&&mas[i+1][j+2]=='1') cout << "E" << endl;
                    else if(mas[i+1][j]=='1'&&mas[i+1][j+1]=='1'&&mas[i+2][j+1]=='1') cout << "F" << endl;
                    else if(mas[i][j+1]=='1'&&mas[i+1][j]=='1'&&mas[i-1][j-1]=='1') cout << "G" << endl;
                }
            }
        }
    }
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	string s;
	while (cin >> s) {
		vector<string>v;
		v.push_back(s);
		rep(i, 0, 7) {
			string t; cin >> t;
			v.push_back(t);
		}
		char ans;
		rep(i, 0, 8) {
			rep(j, 0, 8) {
				if (v[i][j] == '1') {
					if (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1')ans = 'A';
					else if (v[i + 1][j] == '1'&&v[i + 2][j] == '1'&&v[i + 3][j] == '1')ans = 'B';
					else if (v[i][j + 1] == '1'&&v[i][j + 2] == '1'&&v[i][j + 3] == '1')ans = 'C';
					else if (v[i + 1][j] == '1'&&v[i + 1][j - 1] == '1'&&v[i + 2][j - 1] == '1')ans = 'D';
					else if (v[i][j + 1] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 1][j + 2] == '1')ans = 'E';
					else if (v[i + 1][j] == '1'&&v[i + 1][j + 1] == '1'&&v[i + 2][j + 1] == '1')ans = 'F';
					else if (v[i][j + 1] == '1'&&v[i + 1][j] == '1'&&v[i - 1][j - 1] == '1')ans = 'G';
					break;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

char data[8][8];
int px, py;

int main(){
	while (true){
		for(int i = 0; i < 8 ; i++){
			for(int j = 0; j < 8; j++){
				std::cin >> data[i][j];
				if(std::cin.eof())break;
				if(data[i][j] == '1')px = j, py = i;
			}
		}

		if (data[py][px - 1] == '1' && data[py - 1][px] == '1' && data[py - 1][px - 1] == '1')printf("A\n");
		else if (data[py - 1][px] == '1' && data[py - 2][px] == '1' && data[py - 3][px] == '1')printf("B\n");
		else if (data[py][px - 1] == '1' && data[py][px - 2] == '1' && data[py][px - 3] == '1')printf("C\n");
		else if (data[py][px - 1] == '1' && data[py + 1][px - 1] == '1' && data[py - 1][px] == '1')printf("D\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py - 1][px - 2] == '1')printf("E\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py + 1][px] == '1')printf("F\n");
		else if (data[py - 1][px] == '1' && data[py - 1][px + 1] == '1' && data[py][px - 1] == '1')printf("G\n");
	}     
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(void) {
    while(true) {
        vector<int> key;
        for(int r = 0; r < 8; r++) {
            int input; cin >> input;
            if(input != 0) key.push_back(input);
        }
        if(cin.eof()) break;
        int height = (int)key.size();
        switch(height) {
            case 1:cout << "C" << endl; break;
            case 2:
                if(key[0] == key[1]) cout << "A" << endl;
                else if(key[0] > key[1]) cout << "E" << endl;
                else                     cout << "G" << endl;
                break;
            case 3:
                if(key[0] < key[2]) cout << "D" << endl;
                else                cout << "F" << endl;
                break;
            default: cout << "B" << endl;
        }
    }
    return(0);
}