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>
#include<vector>
#include<stdio.h>
using namespace std;

int main(){
    char boa[8][8];
    while(1){
        
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(!(cin>>boa[i][j]))
                    return 0;
            }
        }
        int bo[8][8];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                bo[i][j]=boa[i][j]-'0';
            }
        }
        
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(bo[i][j]==1){
                    if(i<8&&j<8){
                        if(bo[i+1][j]==1&&bo[i][j+1]==1&&bo[i+1][j+1]){
                            cout<<"A"<<endl;
                            goto next;
                        }
                    }
                    if(j<4){
                        if(bo[i][j+1]&&bo[i][j+2]&&bo[j+3]){
                            cout<<"B"<<endl;goto next;
                        }
                            
                    }
                    if(i<4){
                        if(bo[i+1][j]&&bo[i+2][j]&&bo[i+3][j]){
                            cout<<"C"<<endl;goto next;
                        }
                        
                    }
                    if(i<7&&i>0&&j<7){
                        if(bo[i+1][j]&&bo[i][j+1]&&bo[i-1][j+1]){
                            cout<<"D"<<endl;goto next;
                        }
                    }
                    if(i<7&&j<6){
                        if(bo[i][j+1]&&bo[i+1][j+1]&&bo[i+1][j+2]){
                            cout<<"E"<<endl;goto next;
                        }
                    }
                    if(i<6&&j<7){
                        if(bo[i+1][j]&&bo[i+1][j+1]&&bo[i+2][j+1]){
                            cout<<"F"<<endl;goto next;
                        }
                    }
                    if(i<6&&j>0){
                        if(bo[i+1][j]&&bo[i+1][j-1]&&bo[i+2][j-1]){
                            cout<<"F"<<endl;goto next;
                        }
                    }
                    
                }
            }
        }
        
    next:;
        char m;
        cin>>m;
    }
    
    return 0;
}

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

int main(){
	char p[7][19] = {"1100000011", "10000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011"};
	char f[65];
	char t;
	while(1 + scanf("%c", &t)){
		while(t == 10){
			scanf("%c", &t);
		}
		f[0] = t;
		for(int i = 1; i < 64; i++){
			scanf("%c", &t);
			while(t == 10){
				scanf("%c", &t);
			}
			f[i] = t;
		}
		f[64] = '\0';
		for(int i = 0; i < 7; i++){
			if(strstr(f, p[i])){
				printf("%c\n", i + 'A');
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

double dot(P a,P b){return real(conj(a)*b);}
double cross(P a,P b){return imag(conj(a)*b);}

typedef long double Real;

int main(){
  int s;
  while(~scanf("%d",&s)){
    vi x;
    if(s>0)x.push_back(s);
    REPR(i,8){
      scanf("%d",&s);
      if(s>0)x.push_back(s);
    }
    if(x.size()==4){
      puts("B");
    }else if(x.size()==1){
      puts("C");
    }else{
      int a=0,b=0;
      while(x[0]%10==0){
        ++a;
        x[0]/=10;
      }
      while(x[1]%10==0){
        ++b;
        x[1]/=10;
      }
      if(x.size()==3){
        if(a==b){
          puts("D");
        }else{
          puts("F");
        }
      }else{
        if(a==b){
          puts("A");
        }else if(a>b){
          puts("E");
        }else{
          puts("G");
        }
      }
    }
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()


int main(){
    int mod=1000000007;
    int ax, ay;
    char f[12][12];
    bool flag=0;
    for (int i=0;i<12;++i) {
        for (int j=0;j<12;++j) {
            f[i][j]=0;
        }
    }

    for (;;) {
        for (int i=0;i<8;++i) {
            if(scanf("%s",f[i])==EOF) {
                flag=1;
                break;
            }
        }
        if (flag) break;

        for(int i=0;i<64;++i) {
            if (f[i/8][i%8]=='1') {
                ax=i%8;
                ay=i/8;
                break;
            }
        }
        if (f[ay+1][ax]=='1' && f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1') printf("A\n");
        else if (f[ay+1][ax]=='1' && f[ay+2][ax]=='1' && f[ay+3][ax]=='1') printf("B\n");
        else if (f[ay][ax+1]=='1' && f[ay][ax+2]=='1' && f[ay][ax+3]=='1') printf("C\n");
        else if (f[ay+2][ax-1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1') printf("D\n");
        else if (f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' && f[ay+1][ax+2]=='1') printf("E\n");
        else if (f[ay+1][ax]=='1' && f[ay+1][ax+1]=='1' && f[ay+2][ax+1]=='1') printf("F\n");
        else if (f[ay][ax+1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1') printf("G\n");
    }
    return 0;
}