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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}
void Solve(vector<vector<char>> vvc){
  int x = 0,y = 0;
  rep(i,8){
    rep(j,8){
      if(vvc[j][i] == '1'){
        x = j;
        y = i;
        j = 8;
        i = 8;
        break;
      }
    }
  }
  if(x + 1<8 && y + 1<8){
    if(vvc[x+1][y] == '1'){//A,C,E,G
      if(x+2 < 8 && vvc[x+2][y] == '1'){
        cout << 'C'<<endl;
      }
      else if( x-1 >= 0 && vvc[x-1][y+1] == '1'){
        cout << 'G'<<endl;
      }
      else if(vvc[x][y+1] == '1'){
        cout << 'A'<<endl;
      }
      else{
        cout << 'E'<<endl;
      }
    }
    else if(vvc[x][y+1] == '1'){//B,D,F
      if(y+2 < 8 && vvc[x][y+2] == '1'){
        cout << 'B'<<endl;
      }
      else if(vvc[x+1][y+1] == '1'){
        cout << 'F'<<endl;
      }
      else{
        cout << 'D'<<endl;
      }
    }
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(1){
    vector<vector<char>> v(8,vector<char>(8,0));
    rep(i,8){
      rep(j,8){
        cin>> v[j][i];
      }
    }
    if(cin.eof()){
      break;
    }
    Solve(v);
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;



signed main(){
  char M[10][10];
  while(cin>>M[0][0]){
    loop(i,1,8)cin>>M[0][i];
    loop(i,1,8)rep(j,8)cin>>M[i][j];
    bool A=false,B=false,C=false,D=false,E=false,F=false,G=false;
    rep(i,7)rep(j,7){
      if(M[i][j]=='1'&&M[i][j+1]=='1'&&M[i+1][j]=='1'&&M[i+1][j+1]=='1'){
        A=true;
        goto at;
      }
    }
    rep(i,4)rep(j,8){
      if(M[i][j]=='1'&&M[i+1][j]=='1'&&M[i+2][j]=='1'&&M[i+3][j]=='1'){
        B=true;
        goto at;
      }
    }
    rep(i,8)rep(j,4){
      if(M[i][j]=='1'&&M[i][j+1]=='1'&&M[i][j+2]=='1'&&M[i][j+3]=='1'){
        C=true;
        goto at;
      }
    }
    rep(i,7)loop(j,1,8){
      if(M[i][j]=='1'&&M[i+1][j]=='1'&&M[i+1][j-1]=='1'&&M[i+2][j-1]=='1'){
        D=true;
        goto at;
      }
    }
    rep(i,7)rep(j,6){
      if(M[i][j]=='1'&&M[i][j+1]=='1'&&M[i+1][j+1]=='1'&&M[i+1][j+2]=='1'){
        E=true;
        goto at;
      }
    }
    rep(i,6)rep(j,7){
      if(M[i][j]=='1'&&M[i+1][j]=='1'&&M[i+1][j=1]=='1'&&M[i+2][j+1]=='1'){
        F=true;
        goto at;
      }
    }
    rep(i,7)loop(j,1,7){
      if(M[i][j]=='1'&&M[i][j+1]=='1'&&M[i+1][j]=='1'&&M[i+1][j-1]=='1'){
        G=true;
        break;
      }
    }
    cout<<'a'<<endl;
    at: ;
    if(A)cout<<'A'<<endl;
    if(B)cout<<'B'<<endl;
    if(C)cout<<'C'<<endl;
    if(D)cout<<'D'<<endl;
    if(E)cout<<'E'<<endl;
    if(F)cout<<'F'<<endl;
    if(G)cout<<'G'<<endl;
  }
  return 0;
}

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

string s[10];

int main() {
	while(1){
		int t = 0;
		int r = 0;
		bool flag = false;
		for (int i = 0; i < 9; i++) {
			if (!(cin >> s[i]))return 0;
		}
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++)
			{
				if (s[i][j] == '1') {
					if (flag == false) { t = 8 * i + j; flag = true; };
					r += 8 * i + j;
				}
			}
		}
		r -= 4 * t;
		if (r == 19)cout << 'A' << endl;
		else if (r == 48)cout << 'B' << endl;
		else if (r == 6)cout << 'C' << endl;
		else if (r == 30)cout << 'D' << endl;
		else if (r == 20)cout << 'E' << endl;
		else if (r == 34)cout << 'F' << endl;
		else if (r == 16)cout << 'G' << endl; }
}