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<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	string s[20];
	while(cin>>s[5]){
		s[5]="00000"+s[5];
		for(int i=6;i<13;i++){
			cin>>s[i];
			s[i]="00000"+s[i];
		}
		for(int i=5;i<13;i++){
			for(int j=5;	j<13;j++){
				if(s[i][j]=='1'){
					if(s[i+1][j+1]=='1'&&s[i+1][j]=='1'&&s[i][j+1]=='1'){cout<<'A'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+2][j]=='1'&&s[i+3][j]=='1'){cout<<'B'<<endl;goto L;}
					if(s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i][j+3]=='1'){cout<<'C'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i+2][j-1]=='1'){cout<<'D'<<endl;goto L;}
					if(s[i+1][j+1]=='1'&&s[i][j+1]=='1'&&s[i+1][j+2]=='1'){cout<<'E'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j+1]=='1'){cout<<'F'<<endl;goto L;}
					if(s[i+1][j]=='1'&&s[i+1][j-1]=='1'&&s[i][j+1]=='1'){cout<<'G'<<endl;goto L;}
				}
			}
		}L:;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string mass[8];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i-1][j] == '1' && mass[i-1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    
    while (cin >> mass[0] >> mass[1] >> mass[2] >> mass[3] >> mass[4] >> mass[5] >> mass[6] >> mass[7]) {
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1') {
                    c = solve(i, j);
                    cout << c << endl;
                    goto flag;
                }
            }
        }
        flag:;
    }
    
    return 0;
}

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

#define SIZE 8

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

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

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

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

int main(){
  int block[5][4];
  int sx,sy;
  int x,y;
  string line;
  while(true){
    for(int i=0;i<20;i++)block[i%5][i/5] = 0;
    sx=sy=-1;
    for(y=0;y<8;y++){
      if (!(cin>>line))break;
      for(x=0;x<8;x++){
	if (line[x]=='1'){
	  if (sy==-1){sx=x-1;sy=y;}
	  block[x-sx][y-sy] = 1;
	}
      }
    }
    if (y<8)break;
    if(block[2][0]&&block[1][1]&&block[2][1])cout<<"A"<<endl;
    if(block[1][3])cout<<"B"<<endl;
    if(block[4][0])cout<<"C"<<endl;
    if(block[0][2])cout<<"D"<<endl;
    if(block[3][1])cout<<"E"<<endl;
    if(block[2][2])cout<<"F"<<endl;
    if(block[0][1]&&block[2][0])cout<<"G"<<endl;
  }
  return 0;
}

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

int main(){
	char f[9][9];
	while(1){
		bool flag=false;
		
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				if( scanf(" %c", &f[i][j])==EOF){
					flag=true;
					break;
				}
			} 
			if(flag) break;	
		}
		if(flag) break;

		bool ans=false;
		char c='1';
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				
				if(f[j][i]==c){
					if(i<=6 && j<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j+1][i+1]==c){
						printf("A\n");	
						ans=true;
						break;
					}
					else if(j<=4 && f[j+1][i]==c && f[j+2][i]==c && f[j+3][i]==c){
						printf("B\n");	
						ans=true;
						break;
					}
					else if(i<=4 && f[j][i+1]==c && f[j][i+2]==c && f[j][i+3]==c){
						printf("C\n");	
						ans=true;
						break;
					}
					else if(1<=j && j<=6 && i<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j-1][i+1]==c){
						printf("D\n");	
						ans=true;
						break;
					}
					else if(j<=5 && i<=6 && f[j][i+1]==c && f[j+1][i+1]==c && f[j+1][i+2]==c){
						printf("E\n");	
						ans=true;
						break;
					}
					else if(j<=6 && i<=5 && f[j+1][i]==c && f[j+1][i+1]==c && f[j+1][i+2]==c){
						printf("F\n");	
						ans=true;
						break;
					}
					else if(1<=j && i<=5 && f[j][i+1]==c && f[j-1][i+1]==c && f[j-1][i+2]==c){
						printf("G\n");	
						ans=true;
						break;
					}
											
				}
	
			}
			if(ans) break;
		}
			
	}
}