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++: #include<iostream>
using namespace std;

struct pattern_t {
    int w;
    int h;
    char *pat;
    pattern_t( const int _w, const int _h, const char *_pat ){
        w = _w;
        h = _h;
        pat = new char[w*h];
        for( int i=0; i<w*h; i++ ){
            pat[i] = _pat[i];
        }
    }
    ~pattern_t(){
        if( pat ){
            delete[] pat;
            pat = 0;
        }
    }
};

int main(){
    pattern_t patA(2,2,"1111"),
              patB(1,4,"1111"),
              patC(4,1,"1111"),
              patD(2,3,"011110"),
              patE(3,2,"110011"),
              patF(2,3,"101101"),
              patG(3,2,"011110");
    pattern_t *patterns[7] = {&patA, &patB, &patC, &patD, &patE, &patF, &patG};
    char field[8][8];
    while(1){
        for( int i=0; i<8; i++ ){
            string in;
            if(!(cin >> in))   return 0;
            for( int j=0; j<8; j++ ){
                field[i][j] = in[j];
            }
        }
        for( int sy=0; sy<8; sy++ ){
            for( int sx=0; sx<8; sx++ ){
                for( int p=0; p<7; p++ ){
                    pattern_t *pt = patterns[p];
                    if( sy+pt->h > 8 || sx+pt->w > 8 )
                        continue;
                    bool miss = false;
                    for( int dy=0; dy<pt->h; dy++ ){
                        for( int dx=0; dx<pt->w; dx++ ){
                            if( pt->pat[dy*pt->w+dx] != field[sy+dy][sx+dx] ){
                                miss = true;
                                break;
                            }
                        }
                        if( miss )  break;
                    }
                    if( !miss ){
                        cout << (char)('A'+p) << endl;
                    }
                }
            }
        }
    }
    return 0;
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;

int pow(int a,int n){
	if(n <= 0){
		return 1;
	}
	return a * pow(a,n - 1);
}

int main(){
char a[8][9];
int ans = 0;
while(1){
for(int i = 0; i < 8; i++){
if(scanf("%s",&a[i]) == EOF){
return 0;
}
}

for(int i = 0; i < 8; i++){

for(int j = 0; j < 8; j++){

if(a[i][j] == '1'){

if(i < 7 && j < 7){
if(a[i+1][j] == '1' && a[i][j+1] == '1' && a[i+1][j+1] == '1'){
printf("A\n");
}
}
if(i < 5){
if(a[i+1][j] == '1' && a[i+2][j] == '1' && a[i+3][j] == '1'){
printf("B\n");
}
}
if(j < 5){
if(a[i][j+1] == '1' && a[i][j+2] == '1' && a[i][j+3] == '1'){
printf("C\n");
}
}
if(i < 7 && j < 6){
if(a[i][j+1] == '1' && a[i+1][j+1] == '1' && a[i+1][j+2] == '1'){
printf("E\n");
}
}
if(i < 6 && j < 7){
if(a[i+1][j] == '1' && a[i+1][j+1] == '1' && a[i+2][j+1] == '1'){
printf("F\n");
}
}
if(j > 0 && i < 6){
if(a[i+1][j] == '1' && a[i+1][j-1] == '1' && a[i+2][j-1] == '1'){
printf("D\n");
}
}
if(j > 0 && j < 7 && i < 7){
if(a[i+1][j] == '1' && a[i][j+1] == '1' && a[i+1][j-1] == '1'){
printf("G\n");
}
}

}

}

}
}

	///////////////////////////////////
	//Sleep(200000);///////////////////// 提出するときは必ず外す！
	///////////////////////////////////
	return 0;

}

C++: #include <iostream>
#include <algorithm>
#include <complex>
using namespace std;
typedef complex<int> P;
const int N = 8;

const P s[7][4] = {{P(0,0),P(1,0),P(0,1),P(1,1)},
		   {P(0,0),P(0,1),P(0,2),P(0,3)},
		   {P(0,0),P(1,0),P(2,0),P(3,0)},
		   {P(1,0),P(0,1),P(1,1),P(0,2)},
		   {P(0,0),P(1,0),P(1,1),P(2,1)},
		   {P(0,0),P(0,1),P(1,1),P(1,2)},
		   {P(1,0),P(2,0),P(0,1),P(1,1)}};

char g[N][N];

int main() {
  while(cin >> g[0][0]) {
    for(int i = 0; i < N; ++i) {
      for(int j = 0; j < N; ++j) {
	if(!i&&!j) continue;
	cin >> g[i][j];
      }
    }
    int res = -1;
    for(int n = 0; n < 7; ++n) {
      bool flag = true;
      for(int i = 0; i < N; ++i) {
	for(int j = 0; j < N; ++j) {
	  for(int k = 0; k < 4; ++k) {
	    int ni = i + s[n][k].imag();
	    int nj = j + s[n][k].real();
	    if(ni < 0 || ni >= N ||
	       nj < 0 || nj >= N ||
	       g[ni][nj] != '1') {
	      k = (1<<28);
	    }
	    if(k+1 == 4) {
	      res = n;
	      n = i = j = k = (1<<28);
	    }
	  }
	}
      }
    }
    cout << (char)(res+'A') << endl;
  }
  return 0;
}

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

using namespace std;
int main(){
	
	while(1){
	string str[8];
	for(int i =0;i<8;i++)
		cin >> str[i];
	
	bool stop = false;
	for(int i=0;i<8;i++){
	for(int k=0;k<8;k++){
	if(str[i][k] == '1'){
		if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k] == '1' ){
		cout << "A" << endl;  stop = true; break;
		} else if(str[i+1][k] == '1' && str[i+2][k] == '1'&& str[i+3][k] == '1' ){
		cout << "B" << endl; stop = true; break;
		} else if(str[i][k+1] == '1' && str[i][k+2] == '1'&& str[i][k+3] == '1' ){
		cout << "C" << endl;  stop = true; break;
		} else if(str[i+1][k] == '1' && str[i+1][k-1] == '1'&& str[i+2][k-1] == '1' ){
		cout << "D" << endl;  stop = true; break;
		} else if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k+2] == '1' ){
		cout << "E" << endl;  stop = true; break;
		} else if(str[i+1][k] == '1' && str[i+1][k+1] == '1'&& str[i+2][k+1] == '1' ){
		cout << "F" << endl;  stop = true; break;
		} else if(str[i][k+1] == '1' && str[i+1][k] == '1'&& str[i+1][k-1] == '1' ){
		cout << "G" << endl;  stop = true; break;
		}
	
	}
	
	}
	if(stop == true) break;
	}
	if (!getline(cin, str[0]))
    break;
	
	}