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

var emptyBoard = [][]int{{0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0}}

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

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

int main(){
	char a[8][8];
	while(cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[0][3] >> a[0][4] >> a[0][5] >> a[0][6] >> a[0][7]){
		int p, q;
		for(int i = 1; i < 8; i++){
			for(int j = 0; j < 8; j++){
				cin >> a[i][j];
			}
		}
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(a[i][j] == '1'){
					p = i;
					q = j;
					goto LABEL;
				}
			}
		}
		LABEL:
		if(a[p][q+2] == '1'){
			cout << "C" << endl;
		}
		else if(a[p+2][q] == '1'){
			cout << "B" << endl;
		}
		else if(a[p+2][q+1] == '1'){
			cout << "F" << endl;
		}
		else if(a[p+1][q+2] == '1'){
			cout << "E" << endl;
		}
		else if(a[p+1][q+1] == '1'){
			cout << "A" << endl;
		}
		else if(a[p][q+1] == '1'){
			cout << "G" << endl;
		}
		else{
			cout << "D" << endl;
		}
	}
}

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

#define SIZE 8

int main() {
	string source[SIZE];
	while (true) {
		for (int i = 0; i < SIZE; i++) {
			cin >> source[i];
		}

		int map[14][14], x = SIZE, y = SIZE;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				map[i + 3][j + 3] = source[i][j] == '1' ? 1 : 0;
				if (source[i][j] == '1' && j < x && i < y) {
					x = j;
					y = i;
				}
			}
		}
		x += 3;
		y += 3;

		if (map[y + 1][x + 1] == 1) {
			if (map[y][x + 1] == 1 && map[y + 1][x] == 1) {
				cout << "A";
			} else if (map[y + 2][x + 1] == 1) {
				cout << "F";
			} else {
				cout << "E";
			}
		} else if (map[y - 1][x - 1] == 1) {
			if (map[y][x + 1] == 1) {
				cout << "G";
			} else {
				cout << "D";
			}
		} else if (map[y + 3][x]) {
			cout << "B";
		} else {
			cout << "C";
		}
		cout << endl;

		if (cin.eof()) break;
	}
	return 0;
}

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

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

char t[10][10];
int w = 8;
int h = 8;

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

bool check(int y,int x,int kind){
  for(int i=0;i<4;i++){
    int nx = x + dx[kind][i];
    int ny = y + dy[kind][i];
    if(nx>=0 && nx<w && ny>=0 && ny<h){
        if(t[ny][nx] != '1'){
          return false;
        }
    }
      else{
        return false;
        }
  }
    return true;
}

void solve(){
  rep(i,h){
    rep(j,w){
      rep(k,7){
        int tmp = check(i,j,k);
        if(tmp){
          cout<<(char)('A'+k)<<endl;
          return;
        }
      }
    }
  }
}

int main(){
  while(1){
    rep(i,h){
      if(!(cin>>t[i])) return 0;
    }
    solve();
  }
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
char s[100][100];
int main(){
	

	while(cin>>s[1][1]){
		int x,y;
		bool f=false;
		for(int j=2;j<8;j++)
			cin>>s[1][j];
		for(int i=2;i<=8;i++){
			for(int j=1;j<=8;j++){
				cin>>s[i][j];
				if(s[i][j]=='1'&&!f){
					y=i;
					x=j;
					f=true;
				}
			}
		}
		
		if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1')
			cout<<"A"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+2][x]=='1'&&s[y+3][x]=='1')
			cout<<"B"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y][x+2]=='1'&&s[y][x+3]=='1')
			cout<<"C"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1'&&s[y+2][x-1]=='1')
			cout<<"D"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x+1]=='1'&&s[y+1][x+2]=='1')
			cout<<"E"<<endl;
		else if(s[y][x]=='1'&&s[y+1][x]=='1'&&s[y+1][x+1]=='1'&&s[y+2][x+1]=='1')
			cout<<"F"<<endl;
		else if(s[y][x]=='1'&&s[y][x+1]=='1'&&s[y+1][x]=='1'&&s[y+1][x-1]=='1')
			cout<<"E"<<endl;
		
	}
}

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

using pii = pair<int, int>;

int main() {
    string s;
    while(cin >> s) {
        vector<string> v(8);
        v[0] = s;
        for(int i = 0; i < 7; ++i) {
            cin >> v[i + 1];
        }
        vector<vector<pii>> m = {{pii{0, 0}, pii{0, 1}, pii{1, 0}, pii{1, 1}},
                                 {pii{0, 0}, pii{1, 0}, pii{2, 0}, pii{3, 0}},
                                 {pii{0, 0}, pii{0, 1}, pii{0, 2}, pii{0, 3}},
                                 {pii{0, 0}, pii{1, -1}, pii{1, 0}, pii{2, -1}},
                                 {pii{0, 0}, pii{0, 1}, pii{1, 1}, pii{1, 2}},
                                 {pii{0, 0}, pii{1, 0}, pii{1, 1}, pii{2, 1}},
                                 {pii{0, 0}, pii{0, 1}, pii{1, -1}, pii{1, 0}}};
        vector<pii> b;
        for(int i = 0; i < 8; ++i) {
            for(int j = 0; j < 8; ++j) {
                if(v[i][j] == '1') b.emplace_back(i, j);
            }
        }
        sort(begin(b), end(b));
        for(int i = 3; i >= 0; --i) {
            b[i].first -= b[0].first;
            b[i].second -= b[0].second;
        }

        char ans = 'A' + find(begin(m), end(m), b) - begin(m);
        cout << ans << endl;
    }
}