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

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



int MAX = 8;

int main() {
	vcs m(MAX);
	for_(i, 0, MAX) cin >> m[i];
	vector< vcs > b(7);
	b[0].pb("11"); b[0].pb("11");
	b[1].pb("1"); b[1].pb("1"); b[1].pb("1"); b[1].pb("1");
	b[2].pb("1111");
	b[3].pb("01"); b[3].pb("11"); b[3].pb("10");
	b[4].pb("110"); b[4].pb("011");
	b[5].pb("10"); b[5].pb("11"); b[5].pb("01");
	b[6].pb("011"); b[6].pb("110");
	
	for_(k, 0, 7) {
		vcs bl = b[k];
		int Y = (int)bl[0].sz, X = (int)bl.sz;
		
		bool flag = false;
		for_(i, 0, MAX-X+1) for_(j, 0, MAX-Y+1){
			bool f = true;
			for_(x, 0, X) for_(y, 0, Y) {
				if (m[i+x][j+y] != bl[x][y]) f = false;				
			}
			if (f) flag = true;
		}
		
		if (flag) {
			char ans = 'A' + k;
			cout << ans << endl;
			break;
		}
	}
	
	return 0;
}

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

int main()
{
    char field[11][11];
    string r;
    int i,j;
    do {
	for (i=0; i<8; i++)
	{
	    scanf("%s",field[i]);
	}
	for (i=0; i<8; i++)
	{
	    for (j=0; j<8; j++)
	    {
		if (field[i][j] == '1')goto b;
	    }
	}
    b:
	if (field[i][j+1] == '1')
	{
	    if (field[i][j+2] == '1')
		r="C";
	    else if (field[i+1][j] == '1')
		r="A";
	    else
		r="E";
	} else {
	    if (field[i+2][j] == '1')
		r="B";
	    else if (field[i+1][j+1] == '1')
		r="F";
	    else
		r="D";
	}
	cout << r << endl;
	getchar();
    } while (getchar() != EOF);
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
long i,n,n2,f;
string s;
while(cin>>n){
i=2;
while(n==0){cin>>n;i++;}
cin>>n2;
if(n2==0)f=2;
else if(n2==n){if(n%11==0)f=0;else f=1;}
else if(n2==n*11)f=3;
else if(n2==n/10)f=4;
else if(n2==n*10)f=6;
else f=5;
for(;i<8;i++)cin>>n;
cout<<"ABCDEFG"[f]<<endl;
}
return 0;
}

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[20][20];
  for (int i = 0; i < 20; i++) {
    for (int j = 0; j < 20; j++) {
      a[i][j] = '0';
    }
  }
  char c;

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

  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 <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

/*
A 2*2 B 1*4 C 4*1 D 01 E 110 F 10 G 011
                    11   011   11   110
                    10         01
*/

int main() {
	while (true) {
		string in[4];
		string tmp;
		int j=0;
		for (int i=0; i<8; i++) {
			cin >> tmp;
			if (tmp != "00000000") {
				in[j] = tmp;
				j++;
			}
		}
		if (j == 4) {
			cout << "B" << endl;
		} else if (j == 1) {
			cout << "C" << endl;
		} else if (j == 2) {
			if (in[0] == in[1]) {
				cout << "A" << endl;
			} else if (in[0] > in[1]) {
				cout << "E" << endl;
			} else {
				cout << "G" << endl;
			}
		} else {
			if (in[0] > in[1]) {
				cout << "F" << endl;
			} else {
				cout << "D" << endl;
			}
		}
		scanf("\n");
	}
	return 0;
}