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<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    while(1){
        string karifie[8];
        int fie[8][8];
        for(int i=0;i<8;i++){
            if(!(cin>>karifie[i]))goto exit;
        }
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++)fie[i][j]=karifie[i][j]-'0';
        }
        char ans;
        for(int i=0;i<7;i++){
            for(int j=0;j<7;j++)if(fie[i][j]&fie[i+1][j]&fie[i][j+1]&fie[i+1][j+1])ans='A';
        }
        for(int i=0;i<5;i++){
            for(int j=0;j<8;j++)if(fie[i][j]&fie[i+1][j]&fie[i+2][j]&fie[i+3][j])ans='B';
        }
        for(int i=0;i<8;i++){
            for(int j=0;j<5;j++)if(fie[i][j]&fie[i][j+1]&fie[i][j+2]&fie[i][j+3])ans='C';
        }
        for(int i=0;i<6;i++){
            for(int j=0;j<7;j++)if(fie[i+2][j]&fie[i+1][j]&fie[i][j+1]&fie[i+1][j+1])ans='D';
        }
        for(int i=0;i<7;i++){
            for(int j=0;j<6;j++)if(fie[i][j]&fie[i+1][j+2]&fie[i][j+1]&fie[i+1][j+1])ans='E';
        }
        for(int i=0;i<6;i++){
            for(int j=0;j<7;j++)if(fie[i][j]&fie[i+1][j]&fie[i+2][j+1]&fie[i+1][j+1])ans='F';
        }
        for(int i=0;i<7;i++){
            for(int j=0;j<6;j++)if(fie[i][j+2]&fie[i+1][j]&fie[i][j+1]&fie[i+1][j+1])ans='G';
        }
        cout<<ans<<endl;
    }
exit:
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;
typedef pair<double,double> P;




int main(){
	int field[8][8];
	string field1[8];
	
	for(int i = 0;i < 8;i++){
		getline(cin, field1[i]);
	}

	for(int i = 0;i < 8;i++){
		for(int j = 0;j < 8;j++){
			if(field1[i][j] == '1') field[i][j] = 1;
			else field[i][j] = 0;
		}
	}
	/*for(int i = 0;i < 8;i++){
		for(int j = 0;j < 8;j++){
			cout << field[i][j];
		}
		cout << endl;
	}
	cout << endl;*/
	for(int i = 0;i < 8;i++){
		int flag = 0;
		for(int j = 0;j < 8;j++){
			if(field[i][j] == 1){
				//cout << i << j <<endl;
				if(field[i][j] == field[i][j+1]){
					if(field[i][j] == field[i+1][j]){
						if(field[i][j] == field[i+1][j+1]){
							cout << "A" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j-1]){
							cout << "G" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i][j+2] && field[i][j] == field[i][j+3]){
						cout << "C" << endl;
						flag = 1;break;
					}
					else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+1][j+2]){
						cout << "E" << endl;
						flag = 1;break;
					}
				}
				else if(field[i][j] == field[i+1][j]){
					if(field[i][j] == field[i+1][j-1] && field[i][j] == field[i+2][j-1]){
						cout << "D" << endl;
						flag = 1;break;
					}
					else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+2][j+1]){
						cout << "F" << endl;
						flag = 1;break;
					}
				}
				else if(field[i][j] == field[i+1][j] && field[i][j] == field[i+2][j] && field[i][j] == field[i+3][j]){
					cout << "B" << endl;
					flag = 1;break;
				}
			}
		}
		if(flag == 1) break;
	}

	return 0;
}

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

int main(){
	char a[8][8];
	while(cin){
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++) a[i][j] = '0';
			for(int j=0;j<8;j++) cin >> a[i][j];
		}
		int x = 0;
		int y = 0;
		int z = 0;
		for(int j=0;j<8;j++){
			bool b = false;
			for(int i=0;i<8;i++) if(a[i][j]=='1') b = true;
			if(b) x++;
		}
		for(int i=0;i<8;i++){
			bool b = false;
			for(int j=0;j<8;j++) if(a[i][j]=='1') b = true;
			if(b) y++;
		}
		for(int i=0;i<15;i++){
			bool b = false;
			for(int j=0;j<i;j++){
				if(i-j<8) if(a[j][i-j]=='1') b = true;
			}
			if(b) z++;
		}
		if(x==4) cout << "C" << endl;
		else if(y==4) cout << "B" << endl;
		else if(x*y==4) cout << "A" << endl;
		else if(x*z==4) cout << "D" << endl;
		else if(y*z==4) cout << "G" << endl;
		else if(x==3) cout << "E" << endl;
		else if(y==3) cout << "F" << endl;
	}
}

C++: #include<iostream>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
int main(void){
  char maze[9][9];
  while(true){
    rep(i,8)rep(j,8)cin>>maze[i][j];
    if(cin.eof())break;
    bool used = false;
    rep(y,8){
      rep(x,8){
	if(maze[y][x]=='1'){
	  if(maze[ y ][x+1] == '1' && maze[y+1][ x ] =='1' &&
	     maze[y+1][x+1] =='1') cout << "A" << endl;
	  else if(maze[y+1][ x ] == '1' && maze[y+2][ x ] == '1' &&
		  maze[y+3][ x ] == '1') cout << "B" << endl;
	  else if(maze[ y ][x+3] == '1' && maze[y][x+2] == '1' &&
		  maze[ y ][x+1] == '1') cout << "C" << endl;
	  else if(maze[y+1][ x ] == '1' && maze[y+1][x-1] == '1' &&
		  maze[y+2][x-1] == '1') cout << "D" << endl;
	  else if(maze[ y ][x+1] == '1' && maze[y+1][x+1] == '1' &&
		  maze[y+1][x+2] == '1') cout << "E" << endl;
	  else if(maze[y+1][ x ] == '1' && maze[y+1][+1] == '1' &&
		  maze[y+2][x+1] == '1') cout << "F" << endl;
	  else cout << "G" << endl;
	  used = true;
	}
	if(used)break;
      }
      if(used)break;
    }
  }

  return 0;
}