Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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>
#include<cstdio>
using namespace std;

bool map[8][8];

char Solve(int x,int y){

  if(x!=7 && map[y][x+1]==1 && y!=7 && map[y+1][x]==1 && map[y+1][x+1]==1)
    return 'A';

  else if(y<=4&&map[y+1][x]==1&&map[y+2][x]==1&&map[y+3][x]==1)
    return 'B';

  else if(x<=4&&map[y][x+1]==1&&map[y][x+2]==1&&map[y][x+3]==1)
    return 'C';

  else if(x>0&&y<=5&&map[y+1][x]==1&&map[y+1][x-1]==1&&map[y+2][x-1]==1)
    return 'D';

  else if(y<7&&x<=5&&map[y][x+1]==1&&map[y+1][x+1]==1&&map[y+1][x+2]==1)
    return 'E';

  else if(x<7&&y<=5&&map[y+1][x]==1&&map[y+1][x+1]==1&&map[y+2][x+1]==1)
    return 'F';

  else
    return 'G';

}

int main(){

  char c;

  while(cin>>c){

    map[0][0]=c-'0';

    for(int i=1; i<8; i++){cin>>c;map[0][i]=c-'0';}
    for(int i=1; i<8; i++)for(int j=0; j<8; j++){cin>>c;map[i][j]=c-'0';}

    int i,j;
    for(i=0; i<8; i++){
      for(j=0; j<8; j++){
        if(map[i][j]==true)goto BREAK;
      }
    }
    BREAK:;

    for(int m=0;m<8;m++){for(int n=0;n<8;n++)cout<<map[m][n];cout<<endl;}

    cout << Solve(j,i) << endl;

  //  getchar();

  }


  return 0;

}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <complex>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
        a.second < b.second;
    a.first < b.first;
}
vector<string> v;

vector<pair<int, int>> vp;
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(3);
    while (1)
    {
        bool eo = false;
        for (int i = 0; i < 8; ++i)
        {
            string s = "";
            cin >> s;
            if (s == "")
            {
                eo = true;
                break;
            }
            s = "0000" + s;
            s += "0000";
            v.push_back(s);
        }
        if (eo)
            break;
        v.push_back("0000000000000000");
        v.push_back("0000000000000000");
        v.push_back("0000000000000000");

        string ans = "";
        for (int i = 0; i < v.size(); ++i)
        {
            for (int j = 0; j < v[i].size(); ++j)
            {
                if (v[i][j] == '1')
                {
                    if (v[i][j + 1] == '1' && v[i + 1][j] == '1' && v[i + 1][j + 1] == '1')
                    {
                        ans = "A";
                    }
                    else if (v[i + 1][j] == '1' && v[i + 2][j] == '1' && v[i + 3][j] == '1')
                    {
                        ans = "B";
                    }
                    else if (v[i][j + 1] == '1' && v[i][j + 2] == '1' && v[i][j + 3] == '1')
                    {
                        ans = "C";
                    }
                    else if (v[i + 1][j] == '1' && v[i + 1][j - 1] == '1' && v[i + 2][j - 1] == '1')
                    {
                        ans = "D";
                    }
                    else if (v[i][j + 1] == '1' && v[i + 1][j + 1] == '1' && v[i + 1][j + 2] == '1')
                    {
                        ans = "E";
                    }
                    else if (v[i + 1][j] == '1' && v[i + 1][j + 1] == '1' && v[i + 2][j + 1] == '1')
                    {
                        ans = "F";
                    }
                    else if (v[i + 1][j] == '1' && v[i][j + 1] == '1' && v[i + 1][j - 1] == '1')
                    {
                        ans = "G";
                    }
                }
            }
        }
        cout << ans << endl;
    }
    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];
	int count = 0;
	while(cin >> field1[0]){
		for(int i = 1;i < 8;i++){
			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;
		}
		count++;
	}

	return 0;
}