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

C++: #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  char a[8][8];
  char c;

  vector<string> shape(7);
  shape[0] = "1100110000000000";
  shape[1] = "1000100010001000";
  shape[2] = "1111000000000000";
  shape[3] = "0100110010000000";
  shape[4] = "1100011000000000";
  shape[5] = "1000110001000000";
  shape[6] = "0110110000000000";

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

    // for (int i = 0; i < 8; i++) {
    //   for (int j = 0; j < 8; j++) {
    //     cout << a[i][j];
    //   }
    //   cout << endl;
    // }


    int h,w;
    for (int i = 0; i < 64; i++) {
      if (a[i/8][i%8] == '1') {
        h = i / 8;
        w = i % 8;
        break;
      }
    }

    // cout << h << " " << w << endl;

    for (int s = 0; s < 7; s++) {
      bool flag = true;
      for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
          if (shape[s][4 * i + j] != a[h + i][w + j])
            flag = false;
        }
      }

      if (flag) {
        cout << (char)('A' + s) << endl;
        break;
      }
    }

  }
}

C++: /* ??????????????´ */

#include <cstdio>
#include <cassert>
using namespace std;

int field[8][8];

int adx[] = {0, 0, 1, 1};
int ady[] = {0, 1, 0, 1};

int bdx[] = {0, 0, 0, 0};
int bdy[] = {0, 1, 2, 3};

int cdx[] = {0, 1, 2, 3};
int cdy[] = {0, 0, 0, 0};

int ddx[] = {0, 1, 1, 0};
int ddy[] = {0, 0, -1, 1};

int edx[] = {0, 1, 1, 2};
int edy[] = {0, 0, 1, 1};

int fdx[] = {0, 0, 1, 1};
int fdy[] = {0, 1, 1, 2};

int gdx[] = {0, 1, 0, -1};
int gdy[] = {0, 0, 1, 1};


bool WithinRange(int y, int x) {
  if (x < 0) return false;
  if (x >= 8) return false;
  if (y < 0) return false;
  if (y >= 8) return false;

  return true;
}

bool Match(int *dx, int *dy) {
  for (int i=-2; i<10; i++) {
    for (int j=-2; j<10; j++) {
      int sum = 0;

      for (int k=0; k<4; k++) {
        int newy = i+dy[k];
        int newx = j+dx[k];
        if (WithinRange(newy, newx)) sum += field[newy][newx];
      }

      if (sum == 4) return true;
    }
  }

  return false;
}

int main() {
  while (1) {
    for (int i=0; i<8; i++) {
      for (int j=0; j<8; j++) {
        char c;
        if (scanf(" %c", &c) != 1) return 0;
        field[i][j] = (c == '1');
      }
    }

    if (Match(adx, ady)) puts("A");
    else if (Match(bdx, bdy)) puts("B");
    else if (Match(cdx, cdy)) puts("C");
    else if (Match(ddx, ddy)) puts("D");
    else if (Match(edx, edy)) puts("E");
    else if (Match(fdx, fdy)) puts("F");
    else if (Match(gdx, gdy)) puts("G");
    else assert(0);
  }
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

char map[8][9];

char solve() {
	for (int i=0; i<8; ++i) {
		for (int j=0; j<8; ++j) {
			if (map[i][j] == '1') {
				if (i<7 && j<7 && map[i][j+1]=='1' && map[i+1][j]=='1' && map[i+1][j+1]=='1') return 'A';
				if (i<5 && map[i+1][j]=='1' && map[i+2][j]=='1' && map[i+3][j]=='1') return 'B';
				if (j<5 && map[i][j+1]=='1' && map[i][j+2]=='1' && map[i][j+3]=='1') return 'C';
				if (i<6 && map[i+1][j]=='1' && map[i+1][j-1]=='1' && map[i+2][j-1]=='1') return 'D';
				if (i<7 && j<6 && map[i][j+1]=='1' && map[i+1][j+1]=='1' && map[i+1][j+2]=='1') return 'E';
				if (i<6 && j<7 && map[i+1][j]=='1' && map[i+1][j+1]=='1' && map[i+2][j+1]=='1') return 'F';
				if (i<7 && j<7 && map[i][j+1]=='1' && map[i+1][j]=='1' && map[i+1][j+1]=='1') return 'G';
			}
		}
	}
}

int main() {
	while (scanf("%s", map[0]) != EOF) {
		for (int i=1; i<8; ++i) scanf ("%s", map[i]);
		char ans = solve();
		printf ("%c\n", ans);
	}
	return 0;
}

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

int main(){
	char n[12][12];
	char figure[7][4][5] = {
		{"1100","1100","0000","0000"},
		{"1000","1000","1000","1000"},
		{"1111","0000","0000","0000"},
		{"0100","1100","1000","0000"},
		{"1100","0110","0000","0000"},
		{"1000","1100","0100","0000"},
		{"0110","1100","0000","0000"}
	};

	for(int i=0; i<12; i++)
		for(int j=0; j<12; j++)
			n[i][j]='0';
	
	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n", n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])){

		for(int i=0; i<7; i++){
			for(int j=0; j<8; j++){
				for(int k=0; k<8; k++){
					bool flag=true;
					
					for(int x=0; x<4; x++){
						for(int y=0; y<4; y++){
							if(figure[i][x][y] != n[j+x][k+y]) flag = false;
						}
					}
					
					if(flag){
						cout << (char)('A'+i) << endl;
					}

				}
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i) = 0;(i)<(n);(i)++)
#define pb push_back
#define mp make_pair
#define All(X) X.begin(),X.end()

int main(){
	vector<int> vx, vy;
	while (1){
		vx.clear();
		vy.clear();
		REP(i, 8){
			string str;
			cin >> str;
			
			REP(j, 8){
				if (str[j] == '1'){
					vx.pb(i);
					vy.pb(j);
				}
			}
		}
		char ans = 'G';
		if (vx[0] == vx[1] && vy[0] == vy[2]) ans = 'A';
		if (vy[0] == vy[1] && vy[0] == vy[2] && vy[0] == vy[3]) ans = 'B';
		if (vx[0] == vx[1] && vx[0] == vx[2] && vx[0] == vx[3]) ans = 'C';
		if (vx[1] == vx[2] && vy[1] == vy[3] && vy[0] == vy[2]) ans = 'D';
		if (vx[0] == vx[1] && vx[2] == vx[3] && vy[1] == vy[2] && vy[0] + 2 == vy[3]) ans = 'E';
		if (vx[1] == vx[2] && vy[0] == vy[1] && vy[2] == vy[3]) ans = 'F';
		
		cout << ans << endl;
		if (cin.eof()){
			return 0;
		}
	}
}