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 <cstdio>
using namespace std;

void Figure(int str[8][8]){
  int i, k;

  for(i = 0;i < 8;i++){
    for(k = 0;k < 8;k++){
      if(str[i][k] == 1){ //1???????????????
	if(str[i][k + 1] == 1){ //?????¢???A,C,E,G?????????
	  if(str[i][k + 2] == 1){ //???????????°C
	    cout << "C" << endl;
	  }else{ //?????????A,E,G
	    if(str[i + 1][k + 1] == 0){ //???????????°G
	      cout << "G" << endl;
	    }else{ // ?????????A,E
	      if(str[i + 1][k] == 1){ //???????????°A
		cout << "A" << endl; //?????????E
	      }else{
		cout << "E" << endl;
	      }
	    }
	  }
	}else{ //?¬?????????¢B,D,F?????¢???
	  if(str[i + 2][k] == 1){ //???????????°B
	    cout << "B" << endl;
	  }else{ //?????????D,F
	    if(str[i + 1][k + 1] == 1){ //???????????°F
	      cout << "F" << endl;
	    }else{ //?????????D
	      cout << "D" << endl;
	    }
	  }
	}
      }
    }
  }
}


int main(){
  int str[8][8], i, k;

  while(scanf("%d", &str[0][0]) != EOF){
    for(i = 0;i < 8;i++){
      for(k = 0;k < 8;k++){
	if(i != 0 && k != 0){
	  cin >> str[i][k];
	}
      }
    }
    Figure(str);
  }

  return 0;
}

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

/*
0123
456
78
9
*/
const int data[7][10] = {
						{1, 1, 0, 0, 1, 1, 0, 0, 0, 0},
						{1, 0, 0, 0, 1, 0, 0, 1, 0, 1},
						{1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
						{0, 1, 0, 0, 1, 1, 0, 1, 0, 0},
						{1, 1, 0, 0, 0, 1, 1, 0, 0, 0},
						{1, 0, 0, 0, 1, 1, 0, 0, 1, 0},
						{0, 1, 1, 0, 1, 1, 0, 0, 0, 0}
						};

const int change[10][2] = {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 3}, {1, 3}, {0, 4}};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	char c0;
	while(cin >> c0){
		int c[15][15];
		for(int i = 0; i < 15; ++i){
			for(int j = 0; j < 15; ++j){
				c[j][i] = 0;
			}
		}

		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				if(i != 0 || j != 0) cin >> c0;
				c[j][i] = (c0 == '0') ? 0 : 1;
			}
		}

		bool check2 = false;
		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				for(int k = 0; k < 7; ++k){
					bool check = true;
					for(int l = 0; l < 10; ++l){
						if(c[j + change[l][0]][i + change[l][1]] != data[k][l]){
							check = false;
							break;
						}
					}
					if(check){
						cout << char('A' + k) << endl;
						check2 = true;
						break;
					}
				}
				if(check2) break;
			}
			if(check2) break;
		}
	}

	return 0;
}

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

int main(){
	int k, l, a[11][11] = {};
	string in[8], mm;
	while (true)
	{
		for (int i=0;i<8;i++){
			cin >> in[i];
		}
		if (cin.eof()) { break; }

		for (k = 0; k<8; k++) {
			for (l = 0; l<8; l++) {
				mm = in[k][l];
				a[k][l] = stoi(mm);
			}
		}
		for (k = 0; k<8; k++) {
			int z = false;
			for (l = 0; l<8; l++) {
				if(1 ==a[k][l]){
					z = true;
					break;
				}
			}
			if (z) { break; }
		}
		if (a[k + 3][l] == 1) { cout << "B" << endl; }
		else if (a[k][l+3] == 1) { cout << "C" << endl; }
		else if (a[k+1][l + 2] == 1) { cout << "E" << endl; }
		else if (a[k+2][l + 1] == 1) { cout << "F" << endl; }
		else if (a[k+1][l + 1] == 1) { cout << "A" << endl; }
		else if (a[k+2][l - 1] == 1) { cout << "D" << endl; }
		else { cout << "G" << endl; }
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	char field[8][8];
	char tmp;
	int i,j;
	while(1){
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				cin >> field[i][j];
			}
		}
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				if(field[i][j]=='1')goto NEXT;
			}
		}
		NEXT:
			//横一列
			if(j+3<=7&&field[i][j+1]=='1'&&field[i][j+2]=='1'&&field[i][j+3]=='1')
				cout<<"C"<<endl;
			//縦一列
			else if(i+3<=7&&field[i+1][j]=='1'&&field[i+2][j]=='1'&&field[i+3][j]=='1')
				cout<<"B"<<endl;
			//正方形
			else if(j+1<=7&&i+1<=7&&field[i][j+1]=='1'&&field[i+1][j]=='1'&&field[i+1][j+1]=='1')
				cout<<"A"<<endl;
			/*1 0
				1 1
				0 1*/
			else if(i+2<=7&&j+1<=7&&field[i+1][j]=='1'&& field[i+1][j+1]=='1'&&field[i+2][j+1]=='1')
				cout<<"F"<<endl;
			/*0 1 1
				1 1 0*/
			else if(j-1>=0&&j+1<=7&&i+1<= 7&&field[i][j+1]=='1'&&field[i+1][j]=='1'&&field[i+1][j-1]=='1')
				cout<<"G"<<endl;
			/*1 1 0
				0 1 1*/
			else if(j+2<=7&&i+1<=7&&field[i][j+1]=='1'&&field[i+1][j+1]=='1'&&field[i+1][j+2]=='1')
				cout<<"E"<<endl;
			else cout<<"D"<<endl;
			cin.clear();
			cin.ignore();
			if(cin.eof())return 0;
		}
	return 0;
}

C++: 
#include<iostream>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
int main(void){
  char maze[9][9];
  while(true){
    rep(i,8)rep(j,8)cin>>maze[i][j];
    if(cin.eof())break;
    bool used = false;
    rep(y,8){
      rep(x,8){
	if (maze[y][x] == '1') {
	  if (maze[y][x+1] == '1' && maze[y+1][x] == '1' && maze[y+1][x+1] == '1')
	    cout << "A" << endl;
	  else if (maze[y+1][x] == '1' && maze[y+2][x] == '1' && maze[y+3][x] == '1')
	    cout << "B" << endl;
	  else if (maze[y][x+1] == '1' && maze[y][x+2] == '1' && maze[y][x+3] == '1')
	    cout << "C" << endl;
	  else if (maze[y+1][x] == '1' && maze[y+1][x-1] == '1' && maze[y+2][x-1] == '1')
	    cout << "D" << endl;
	  else if (maze[y][x+1] == '1' && maze[y+1][x+1] == '1' && maze[y+1][x+2] == '1')
	    cout << "E" << endl;
	  else if (maze[y+1][x] == '1' && maze[y+1][x+1] == '1' && maze[y+2][x+1] == '1')
	    cout << "F" << endl;
	  else
	    cout << "G" << endl;
	  used = true;
	}
        if(used)break;
      }
      if(used)break;
    }
  }

  return 0;
}