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 <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

string grid[8];
bool is_A(int i,int j) {
    if(i+1>=8 || j+1>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i][j+1]=='0') return false;
    if(grid[i+1][j+1]=='0') return false;
    return true;

}
bool is_B(int i,int j) {
    if(i+3>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i+2][j]=='0') return false;
    if(grid[i+3][j]=='0') return false;
    return true;
}
bool is_C(int i,int j) {
    if(j+3>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i][j+1]=='0') return false;
    if(grid[i][j+2]=='0') return false;
    if(grid[i][j+3]=='0') return false;
    return true;
}
bool is_D(int i,int j) {
    if(i+2>=8||j-1<0) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i+1][j-1]=='0') return false;
    if(grid[i+2][j-1]=='0') return false;
    return true;
}
bool is_E(int i,int j) {
    if(i+1>=8||j+2>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i][j+1]=='0') return false;
    if(grid[i+1][j+1]=='0') return false;
    if(grid[i+1][j+2]=='0') return false;
    return true;
}
bool is_F(int i,int j) {
    if(j+1>=8||i+2>=8) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i+1][j]=='0') return false;
    if(grid[i+1][j+1]=='0') return false;
    if(grid[i+2][j+1]=='0') return false;
    return true;
}
bool is_G(int i,int j) {
    if(i+1>=8||j-2<0) return false;
    if(grid[i][j]=='0') return false;
    if(grid[i][j-1]=='0') return false;
    if(grid[i+1][j-1]=='0') return false;
    if(grid[i+1][j-2]=='0') return false;
    return true;
}
void solve() {
    rep(i,8) rep(j,8) {

        if(is_A(i,j)) {
            cout<<"A"<<endl;
            return;
        }
        if(is_B(i,j)) {
            cout<<"B"<<endl;
            return;
        }
        if(is_C(i,j)) {
            cout<<"C"<<endl;
            return;
        }
        if(is_D(i,j)) {
            cout<<"D"<<endl;
            return;
        }
        if(is_E(i,j)) {
            cout<<"E"<<endl;
            return;
        }
        if(is_F(i,j)) {
            cout<<"F"<<endl;
            return;
        }
        if(is_G(i,j)) {
            cout<<"G"<<endl;
            return;
        }
        if(is_B(i,j)) {
            cout<<"B"<<endl;
            return;
        }
        if(is_B(i,j)) {
            cout<<"B"<<endl;
            return;
        }
    }

    cout<<"hoge"<<endl;
}
int main() {
    while(cin>>grid[0]) {
        rep(i,7) cin>>grid[i+1];
        solve();

    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

string fuck(vector<pair<int,int>>&xs) {
  int i0 = INF;
  int j0 = INF;
  int i1 = -INF;
  int j1 = -INF;
  bool zero = false;

  rep (k, 4) {
    int i = car(xs[k]);
    int j = cdr(xs[k]);
    i0 = min(i0, i);
    j0 = min(j0, j);
    i1 = max(i1, i);
    j1 = max(j1, j);
    if (!i && !j) zero = true;
  }

  if (i1 == 3) return "B";
  if (j1 == 3) return "C";
  if (i1 == 1 && j1 == 1) return "A";

  if (i1 == 2) {
    if (zero) return "F";
    return "D";
  }

  if (zero) return "E";
  return "G";
}

int main() {

  loop {
    string ln[8];
    rep (i, 8) cin >> ln[i];

    vector<pair<int,int>> xs;
    int mi = INF;
    int mj = INF;
    rep (i, 8) {
      rep (j, 8) {
        if (ln[i][j] == '1') {
          xs.push_back(cons(i, j));
          mi = min(mi, i);
          mj = min(mj, j);
        }
      }
    }

    rep (i, 4) {
      xs[i] = cons(car(xs[i]) - mi, cdr(xs[i]) - mj);
    }

    cout << fuck(xs) << endl;

    getline(cin, ln[0]);
    if (!cin) break;
  }

  return 0;
}