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
}

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

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;
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){

	while(1){
		int data[7]={22,60,6,38,24,42,20},a=0,b=0,sum=0;
		char x;
		rer(i,1,8){
			rer(j,1,8){
				cin>>x;
				if(cin.eof()) return 0;
				if(x=='1'){
					if(a==0 && b==0){
						a=i; b=j;
					}else{
						sum+=10*(i-a)+j-b;
					}
				}
				//o(sum);
			}
		}
		rep(i,0,7){
			if(sum==data[i]){
				char c;
				c='A'+i;
				o(c); break;
			}
		}
	}
}

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

char f[8][8];

int main()
{ 
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      cin >> f[i][j];
    }
  }

  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      if (f[i][j] == '1'){
        if (f[i + 1][j] == '1'){
          if (f[i][j + 1] == '1'){
            if (f[i + 1][j + 1] == '1'){
              cout << 'A';
              goto g;
            }
            else {
              cout << 'G';
              goto g;
            }
          }
          else if (f[i + 1][j + 1] == '1') {
            cout << 'F';
            goto g;
          }
          else if (f[i - 1][j + 1] == '1'){
            cout << 'D';
            goto g;
          }
          else if (f[i + 2][j] == '1'){
            cout << 'B';
            goto g;
          }
        }
        else if (f[i][j + 1] == '1'){
          if (f[i + 1][j + 1] == '1'){
            cout << 'E';
            goto g;
          }
          else if (f[i][j + 2]){
            cout << 'C';
            goto g;
          }
        }
      }
    }
  }
g:
  cout << endl;
  return (0);
}

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[8][8];
int main(){
	

	while(cin>>s[0][0]){
		for(int j=1;j<8;j++){
			cin>>s[0][j];
		}
		for(int i=1;i<8;i++){
			for(int j=0;j<8;j++){
				cin>>s[i][j];
			}
		}
		for(int y=0;y<8;y++){
			for(int x=0;x<8;x++){
		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<<"G"<<endl;
			}
		}
	}
}