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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;


int main()
{
  int s[20][20]={};
  int i,j;
  char a;

  do{
  int si=0,sj=0;
  bool c=true;
    for(i=5;i<13;i++)
      for(j=5;j<13;j++){
	scanf("\n%c",&a);
	s[i][j]=a-'0';
	if(s[i][j] && c){
	  c=false;
	  si=i;
	  sj=j;
	}
      }

    if(s[si][sj+1]){//a,c,e,g
      if(s[si+1][sj]){//a,g
	if(s[si+1][sj+1])
	  cout<<"A"<<endl;
	else
	  cout<<"G"<<endl;
      }else{//c.e
	if(s[si][sj+2])
	  cout<<"C"<<endl;
	else
	  cout<<"E"<<endl;
      }
    }else{//b,d,f
      if(s[si+2][sj])
	cout<<"B"<<endl;
      else if(s[si+1][sj-1])
	cout<<"D"<<endl;
      else
	cout<<"F"<<endl;
    }

  }while(scanf("%c",&a)!=EOF);

}

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++)

char mass[16][16];

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;
    bool f;
    
    while (!cin.eof()) {
        f = false;

        rep(i, 8) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    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 <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(), (x).end()
#define pb push_back

char a[10][10];

bool is_a(int i, int j) {
    return (a[i][j+1]=='1'&&a[i+1][j]=='1'&&a[i+1][j+1]=='1');
}
bool is_b(int i, int j) {
    return (a[i+1][j]=='1'&&a[i+2][j]=='1'&&a[i+3][j]=='1');
}
bool is_c(int i, int j) {
    return (a[i][j+1]=='1'&&a[i][j+2]=='1'&&a[i][j+3]=='1');
}
bool is_d(int i, int j) {
    return (a[i+1][j]=='1'&&a[i+1][j-1]=='1'&&a[i+2][j-1]=='1');
}
bool is_e(int i, int j) {
    return (a[i][j+1]=='1'&&a[i+1][j+1]=='1'&&a[i+1][j+2]=='1');
}
bool is_f(int i, int j) {
    return (a[i+1][j]=='1'&&a[i+1][j+1]=='1'&&a[i+2][j+1]=='1');
}
bool is_g(int i, int j) {
    return (a[i][j+1]=='1'&&a[i+1][j]=='1'&&a[i+1][j-1]=='1');
}

int main() {
    while(cin >> a[0]) {
        FOR(i,1,8) cin >> a[i];
        //rep(i,8) cout << a[i] << endl;
        rep(i,8) rep(j,8) {
            if(a[i][j] == '1') {
                if(is_a(i,j)) cout<<"A"<<endl;
                if(is_b(i,j)) cout<<"B"<<endl;
                if(is_c(i,j)) cout<<"C"<<endl;
                if(is_d(i,j)) cout<<"D"<<endl;
                if(is_e(i,j)) cout<<"E"<<endl;
                if(is_f(i,j)) cout<<"F"<<endl;
                if(is_g(i,j)) cout<<"G"<<endl;
            }
        }
    }

    return 0;
}

C++: #include<iostream>
#include<vector>
#include<array>
#include<string>
#include<sstream>
#define _X_ 0
#define _Y_ 1
int main()
{
	while (true)
	{
		std::vector<std::array<int, 2>>p;
		p.reserve(4);
		for (int i = 0; i < 8; i++)
		{
			std::string temp;
			std::cin >> temp;
			std::stringstream st(temp);
			for (int j = 0; j < 8; j++)
			{
				char foo;
				st >> foo;
				if (foo == '1')
				{
					p.push_back({ j, i });
				}
			}
		}
		if (p[0][_Y_] == p[1][_Y_])
		{
			if (p[0][_X_] == p[2][_X_])
			{
				std::cout << 'A' << std::endl;
			}
			else if (p[0][_Y_] == p[2][_Y_])
			{
				std::cout << 'C' << std::endl;
			}
			else if (p[1][_X_] == p[2][_X_])
			{
				std::cout << 'E' << std::endl;
			}
			else if (p[0][_X_] == p[3][_X_])
			{
				std::cout << 'G' << std::endl;
			}
		}
		else
		{
			if (p[0][_X_] == p[3][_X_])
			{
				std::cout << 'B' << std::endl;
			}
			else if (p[0][_X_] > p[3][_X_])
			{
				std::cout << 'D' << std::endl;
			}
			else
			{
				std::cout << 'F' << std::endl;
			}
		}
	}
	return 0;
}