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 <string>

using namespace std;

string s[8];

int check( int i , int j ){

  if( i + 1 < 8 && j + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j] == '1' ){
      return 1;
    }
  }
  if( i + 3 < 8 ){
    if( s[i+1][j] == '1' && s[i+2][j] == '1' && s[i+3][j] == '1' ){
      return 2;
    }
  }
  if( j + 3 < 8 ){
    if( s[i][j+1] == '1' && s[i][j+2] == '1' && s[i][j+3] == '1' ){
      return 3;
    }
  }
 if( j - i >= 0 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j-1] == '1' && s[i+2][j-1] == '1' ){
      return 4;
    }
  }
 if( j + 2 < 8 && i + 1 < 8 ){
    if( s[i][j+1] == '1' && s[i+1][j+1] == '1' && s[i+1][j+2] == '1' ){
      return 5;
    }
  }
  if( j + 1 < 8 && i + 2 < 8 ){
    if( s[i+1][j] == '1' && s[i+1][j+1] == '1' && s[i+2][j+1] == '1' ){
      return 6;
    }
  }
  return 7;
}

int main(void){
  
  while( cin >> s[0] ){

    for( int i = 1 ; i < 8 ; i++ ){
	cin >> s[i];
    }

    for( int i = 0 ; i < 8 ; i++ ){
      for( int j = 0 ; j < 8 ; j++ ){
	if( s[i][j] == '1' ){
	  // cout << check( i , j ) << "---" <<  endl;
	  switch( check( i , j ) ){
	  case 1:
	    cout << "A" << endl;
	    break;
	  case 2:
	    cout << "B" << endl;
	    break;
	  case 3:
	    cout << "C" << endl;
	    break;
	  case 4:
	    cout << "D" << endl;
	    break;
	  case 5:
	    cout << "E" << endl;
	    break;
	  case 6:
	    cout << "F" << endl;
	    break;
	  case 7:
	    cout << "G" << endl;
	    break;
	  }
	  goto end;
	}
      }
    }
   end:;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#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];
		}

		if (cin.eof()) break;

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

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

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const char dat[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" },
};

char f[16][16];

bool match(int k, int x, int y) {
    rep (i, 4) rep (j, 4) if (f[x+i][y+j] != dat[k][i][j]) return false;
    return true;
}

int solve() {
    rep (k, 7) rep (i, 8) rep (j, 8) if (match(k, i, j)) return k;
    return -1;
}

int main() {
    while (scanf(" %c", f[0]) != EOF) {
        rep (i, 8) rep (j, 8) if (i || j) scanf(" %c", f[i]+j);
        printf("%c\n", (char)('A'+solve()));
    }
    return 0;
}

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

int main(){

  string s[100];

  while(cin >> s[0]){
    for(int i=1;i<8;i++) cin >> s[i];
    cout << s[99][7] << endl;

    for(int i=0;i<8;i++){
      for(int j=0;j<8;j++){
	if(s[i][j] == '1'){

	  if(s[i][j+1] == '1'){
	    if(s[i][j+2] == '1') cout << "C" << endl;
	    else if(s[i+1][j-1] == '1') cout << "G" << endl;
	    else if(s[i+1][j] == '1') cout << "A" << endl;
	    else if(s[i+1][j+1] == '1') cout << "E" << endl;
	  }

	  else if(s[i+1][j] == '1'){
	    if(s[i+2][j+1] == '1') cout << "F" << endl;
	    else if(s[i+1][j-1] == '1') cout << "D" << endl;
	    else if(s[i+3][j] == '1') cout << "B" << endl;
	  }
	  i = 8;
	  j = 8;
	}

      }
    }
  }
}

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

#define SIZE 8

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

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

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