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()
{
	int i,j;
	char map[10][10];
	
	for(;cin >> map[0][0];)
	{
		int sx,sy,flag=0;;
		
		for(i=0;i<8;i++)
		{
			for(j=0;j<8;j++)
			{
				if(i==0 && j==0)
					j++;
				cin >> map[i][j];
				
				
				if(map[i][j]=='1' && flag==0)
				{
					sy=i;
					sx=j;
					flag=1;
				}
			}
		}
		
		if(map[sy][sx+1]=='1')
		{
			if(map[sy+1][sx]=='1')
			{
				if(map[sy+1][sx+1]=='1')
					cout << "A" << endl;
				else
					cout << "G" << endl;
			}
			else
			{
				if(map[sy][sx+2]=='1')
					cout << "C" << endl;
				else
					cout << "E" << endl;
			}
		}
		else
		{
			if(map[sy+2][sx]=='1')
				cout << "B" << endl;
			else
			{
				if(map[sy+1][sx+1]=='1')
					cout << "F" << endl;
				else
					cout << "D" << endl;
			}
		}
	}
}

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

int main() {
  char x;
 NEXT:
  while(1) {
    if(cin.eof()) {goto END;}
    cin.get(x);
    if(x == '1') {
      break;
    }
  }
  cin.get(x);
  if(x == '1') {// A,C,E,G
    cin.get(x);
    if(x == '1') // C
      cout << "C" << endl;
    else if(x == '0') {//A,E,G
      for(int i=0;i<6;i++){
        cin.get(x);
      }
      if(x == '1')
        cout << "G" << endl; // G
      else if(x == '0') {
        cin.get(x);
        if(x == '1')
          cout << "A" << endl; // A
        else if(x == '0')
          cout << "E" << endl; // E
      }
    }
  }
  else if(x == '0') {//B,D,F
    for(int i=0;i<6;i++) {
      cin.get(x);
    }
    if(x == '1')
      cout << "D" << endl;
    else if(x == '0') {
      cin.get(x);
      cin.get(x);
      if(x == '1')
        cout << "F" << endl;
      else if (x == '0')
        cout << "B" << endl;
    }
  }
  while(1){
    cin.get(x);
    if(x == '\n') {
      cin.get(x);
      if(x == '\n')
        goto NEXT;
    }
  }
 END:
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

char s[18][18];
string buf;
int main(){
	do{
		memset(s,0,sizeof(s));
		for(int i=1;i<=8;i++)scanf("%s",s[i]+1);
		for(int i=1;i<=8;i++){
			for(int j=1;j<=8;j++){
				if(s[i][j]!='1')continue;
				if(s[i][j+1]=='1'&&s[i+1][j+1]=='1'&&s[i+1][j]=='1')puts("A");
				if(s[i+1][j]=='1'&&s[i+2][j]=='1'&&s[i+3][j]=='1')puts("B");
				if(s[i][j+1]=='1'&&s[i][j+2]=='1'&&s[i][j+3]=='1')puts("C");
				if(s[i+1][j-1]=='1'&&s[i+1][j]=='1'&&s[i+2][j-1]=='1')puts("D");
				if(s[i][j+1]=='1'&&s[i+1][j+1]=='1'&&s[i+1][j+2]=='1')puts("E");
				if(s[i+1][j]=='1'&&s[i+1][j+1]=='1'&&s[i+2][j+1]=='1')puts("F");
				if(s[i][j+1]=='1'&&s[i+1][j-1]=='1'&&s[i+1][j]=='1')puts("F");
			}
		}
	}while(getline(cin,buf));
	return 0;
}

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

int main(){
    char mat[8][8]={0};
    
    while(cin >> mat[0]){
        char ans;
        
        for(int i = 1; i < 8 ; i++) cin >> mat[i];
        
        for(int i = 0 ; i < 8 ; i++)
            for(int j = 0 ; j < 8 ; j++)
                mat[i][j] -= '0';
        
        for(int i = 0 ;  ; i++){
            for(int j = 0 ; j < 8 ; j++){
                if(mat[i][j] == 1){
                    if(mat[i][j+3]) ans = 'C';
                    else if(mat[i+3][j]) ans = 'B';
                    else if(mat[i][j+1]&&mat[i+1][j]&&mat[i+1][j+1]) ans = 'A';
                    else if(mat[i+1][j-1]&&mat[i+2][j-1]) ans = 'D';
                    else if(mat[i][j+1]&&mat[i+1][j+2]) ans = 'E';
                    else if(mat[i+1][j]&&mat[i+2][j+1]) ans = 'F';
                    else ans = 'G';
                    
                    goto end;
                }
                
            }
        }
        end:
        cout << ans << endl;
        
        }

    
    return 0;
}

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

int main(){
    int s[8][8];
    int tmp;
    for(int i=0; i<8; i++){
        cin >> tmp;
        for(int j=7; j>=0; j--){
            s[i][j] = tmp % 10;
            tmp /= 10;
        }
    }
    for(int i=0; i<8; i++){
        for(int j=0; j<8; j++){
            if(s[i][j] == 1){
                if(s[i][j+1] == 1 && s[i+1][j] == 1 && s[i+1][j+1] == 1) cout << "A" << endl;
                if(s[i+1][j] == 1 && s[i+2][j] == 1 && s[i+3][j] == 1) cout << "B" << endl;
                if(s[i][j+1] == 1 && s[i][j+2] == 1 && s[i][j+3] == 1) cout << "C" << endl;
                if(s[i+1][j] == 1 && s[i+1][j-1] == 1 && s[i+2][j-1] == 1) cout << "D" << endl;
                if(s[i][j+1] == 1 && s[i+1][j+1] == 1 && s[i+1][j+2] == 1) cout << "E" << endl;
                if(s[i+1][j] == 1 && s[i+1][j+1] == 1 && s[i+2][j+1] == 1) cout << "F" << endl;
                if(s[i][j+1] == 1 && s[i+1][j] == 1 && s[i+1][j-1] == 1) cout << "G" << endl;
            }
        }
    }
    return 0;
}