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(), "")
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

string s[8];
signed main(void)
{
  int cnt = 0;
  while(getline(cin, s[cnt])) {
    if(s[cnt] == "") continue;
    if(cnt == 7) {
      REP(i, 8) REP(j, 8) {
        if(i <= 6 && j <= 6 && s[i][j] == '1' && s[i][j+1] == '1' && s[i+1][j] == '1' && s[i+1][j+1] == '1')
          cout << "A" << endl;
        else if(i <= 4 && s[i][j] == '1' && s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1')
          cout << "B" << endl;
        else if(j <= 4 && s[i][j] == '1' && s[i][j+1] == '1' && s[i][j+2] == '1' && s[i][j+3] == '1')
          cout << "C" << endl;
        else if(i <= 5 && j >= 1 && s[i][j] == '1' && s[i+1][j] == '1' && s[i+1][j-1] == '1' && s[i+2][j-1] == '1')
          cout << "D" << endl;
        else if(i <= 6 && j <= 5 && s[i][j] == '1' && s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1')
          cout << "E" << endl;
        else if(i <= 5 && j <= 6 && s[i][j] == '1' && s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1')
          cout << "F" << endl;
        else if(i >= 1 && j <= 5 && s[i][j] == '1' && s[i][j+1] == '1' && s[i-1][j+1] == '1' && s[i-1][j+2] == '1')
          cout << "G" << endl;
      }
    }
    cnt++;
    if(cnt == 8) cnt = 0;
  }

  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<vector>

using namespace std;

int main(){
    const int mapsize = 64;
    vector<char> sur(mapsize);
    const int fig[] = {9, 24, 3, 15, 10, 16, 8};
    vector<int> ::iterator it;
    int k=0, cnt=0;

    while(cin>>sur[0]){
    for(int i=1; i<mapsize; i++){
        cin>> sur[i];
    }

    for(int i=0; i<mapsize; i++){
        if(sur[i]==49){
            k++;
            if(k==4) break;
        }
        if(k!=0){
            cnt++;
        }
    }

    for(int i=0; i<7; i++){
        if(fig[i] == cnt){
            printf("%c\n", 65+i);
        }
    }
    }

    return 0;
}

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

int main()
{
	while(1){
		vector<vector<int> > all;
		bool endflg = false;
		vector<int> vbuf = vector<int>(13, 0);
		all.push_back(vbuf);
		for(int i=0; i<8; i++){
			string buf;
			if(!(cin>>buf)) endflg = true;
			if(endflg) break;

			vector<int> vb;
			vb.push_back(0);
			for(int j=0; j<12; j++){
				if(j<8) vb.push_back(buf[j]-'0');
				else    vb.push_back(0);
			}
			all.push_back(vb);
		}
		if(endflg) break;
		for(int i=0; i<4; i++){
			all.push_back(vbuf);
		}

		/*
		for(int i=0; i<all.size(); i++){
			for(int j=0; j<all[i].size(); j++){
				cout<<all[i][j];
			}
			cout<<endl;
		}
		cout<<endl;
		*/

		string ans = "NG";
		for(int i=1; i<9; i++){
			bool breakflg = false;
			for(int j=1; j<9; j++){
				if(all[i][j]==1){
					if(all[i][j+1]&&all[i+1][j]&&all[i+1][j+1]){
						ans = "A";
					} else if(all[i+1][j]&&all[i+2][j]&&all[i+3][j]){
						ans = "B";
					} else if(all[i][j+1]&&all[i][j+2]&&all[i][j+3]){
						ans = "C";
					} else if(all[i+1][j]&&all[i+1][j-1]&&all[i+2][j-1]){
						ans = "D";
					} else if(all[i][j+1]&&all[i+1][j+1]&&all[i+1][j+2]){
						ans = "E";
					} else if(all[i+1][j]&&all[i+1][j+1]&&all[i+2][j+1]){
						ans = "F";
					} else if(all[i][j+1]&&all[i+1][j-1]&&all[i+1][j]){
						ans = "G";
					}
					breakflg = true;
					break;
				}
			}
			if(breakflg) break;
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

char f[8][8];

int main()
{ 
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      cin >> f[i][j];
    }
  }

  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      if (f[i][j] == '1'){
        if (f[i + 1][j] == '1'){
          if (f[i][j + 1] == '1'){
            if (f[i + 1][j + 1] == '1'){
              cout << 'A';
              goto g;
            }
            else {
              cout << 'G';
              goto g;
            }
          }
          else if (f[i + 1][j + 1] == '1') {
            cout << 'F';
            goto g;
          }
          else if (f[i - 1][j + 1] == '1'){
            cout << 'D';
            goto g;
          }
          else if (f[i + 2][j] == '1'){
            cout << 'B';
            goto g;
          }
        }
        else if (f[i][j + 1] == '1'){
          if (f[i + 1][j + 1] == '1'){
            cout << 'E';
            goto g;
          }
          else if (f[i][j + 2]){
            cout << 'C';
            goto g;
          }
        }
      }
    }
  }
g:
  cout << endl;
  return (0);
}

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' && sx+1<8)
		{
			if(map[sy+1][sx]=='1' && sy+1<8)
			{
				if(map[sy+1][sx+1]=='1')
					cout << "A" ;
				else
					cout << "G" ;
			}
			else
			{
				if(map[sy][sx+2]=='1' && sx+2<8)
					cout << "C" ;
				else
					cout << "E" ;
			}
		}
		else
		{
			if(map[sy+2][sx]=='1' && sy+2<8)
				cout << "B" ;
			else
			{
				if(map[sy+1][sx+1]=='1' && sx+1<8)
					cout << "F" ;
				else
					cout << "D" ;
			}
		}
	}
}