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>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

char Types(char x[12][11]);

int main () {
    char x[12][11];

//    for(int i=0; i<12; i++){
//        for(int j=0; j<11; j++){
//            cout<<x[i][j];
//        }
//    }
    while(1){
        for(int i=0; i<12; i++){
            for(int j=0; j<11; j++){
                x[i][j]='0';
            }
        }
        for(int i=1; i<9; i++){
            for(int j=0; j<8; j++){
                cin>>x[i][j];
            }
        }
        cout << Types(x) <<endl;
    }
    
    return 0;
}

char Types(char x[12][11]){
    for(int i=1; i<9; i++){
        for(int j=0; j<8; j++){
            if(x[i][j]=='1'){
                if(x[i+1][j]=='1'&&x[i][j+1]=='1'&&x[i+1][j+1]=='1'){
                    return 'A';
                }else if(x[i+1][j]=='1'&&x[i+2][j]=='1'&&x[i+3][j]=='1'){
                    return 'B';
                }else if(x[i][j+1]=='1'&&x[i][j+2]=='1'&&x[i][j+3]=='1'){
                    return 'C';
                }else if(x[i+1][j]=='1'&&x[i+1][j-1]=='1'&&x[i+2][j-1]=='1'){
                    return 'D';
                }else if(x[i][j+1]=='1'&&x[i+1][j+1]=='1'&&x[i+1][j+2]=='1'){
                    return 'E';
                }else if(x[i+1][j]=='1'&&x[i+1][j+1]=='1'&&x[i+2][j+1]=='1'){
                    return 'F';
                }else if(x[i][j+1]=='1'&&x[i+1][j]=='1'&&x[i-1][j+1]=='1'){
                    return 'G';
                }
            }
        }
    }
    return 'Z';
}

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 < 6 && j < 5){
if(a[i][j+1] == '1' && a[i+1][j+1] == '1' && a[i+1][j+2] == '1'){
printf("E\n");
}
}
if(i < 5 && 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 < 5){
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<string>
using namespace std;

string map[8];

void check( int x, int y ){
	int blocks[7][3][2] = {
		{{1,0}, {0,1}, {1,1}},
		{{0,1}, {0,2}, {0,3}},
		{{1,0}, {2,0}, {3,0}},
		{{0,1}, {-1,1}, {-1,2}},
		{{1,0}, {1,1}, {2,1}},
		{{0,1}, {1,1}, {1,2}},
		{{1,0}, {0,1}, {-1,1}}
	};
	for( int i=0; i<7; i++ ){
		bool match = true;
		for( int j=0; j<3; j++ ){
			int xx = x+blocks[i][j][0];
			int yy = y+blocks[i][j][1];
			if( xx<0 || xx>=8 || yy<0 || yy>=8 ){
				match = false;
				break;
			}
			if( map[yy][xx] == '0' ){
				match = false;
			}
		}
		if( match ){
			cout << (char)('A'+i) << endl;
			break;
		}
	}
}

int main(){
	while(1){
		int k = -1;
		for( int i=0; i<8; i++ ){
			getline( cin, map[i] );
			if( map[i].length()==0 )
				return 0;
			if( k==-1 && map[i]!="00000000" ){
				k = i;
			}
		}
		for( int i=0; i<8; i++ ){
			if( map[k][i] == '1' ){
				check(i, k);
				break;
			}
		}
		string br;
		getline( cin, br );
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

char Types(char x[12][11]);

int main () {
    char x[12][11];

//    for(int i=0; i<12; i++){
//        for(int j=0; j<11; j++){
//            cout<<x[i][j];
//        }
//    }
    while(1){
        for(int i=0; i<12; i++){
            for(int j=0; j<11; j++){
                x[i][j]='0';
            }
        }
        for(int i=1; i<9; i++){
            for(int j=0; j<8; j++){
                cin>>x[i][j];
            }
        }
        char ans = Types(x);
        
        if(ans == 'z'){
            break;
        }
        
        cout << ans <<endl;
    }
    
    return 0;
}

char Types(char x[12][11]){
    for(int i=1; i<9; i++){
        for(int j=0; j<8; j++){
            if(x[i][j]=='1'){
                if(x[i+1][j]=='1'&&x[i][j+1]=='1'&&x[i+1][j+1]=='1'){
                    return 'A';
                }else if(x[i+1][j]=='1'&&x[i+2][j]=='1'&&x[i+3][j]=='1'){
                    return 'B';
                }else if(x[i][j+1]=='1'&&x[i][j+2]=='1'&&x[i][j+3]=='1'){
                    return 'C';
                }else if(x[i+1][j]=='1'&&x[i+1][j-1]=='1'&&x[i+2][j-1]=='1'){
                    return 'D';
                }else if(x[i][j+1]=='1'&&x[i+1][j+1]=='1'&&x[i+1][j+2]=='1'){
                    return 'E';
                }else if(x[i+1][j]=='1'&&x[i+1][j+1]=='1'&&x[i+2][j+1]=='1'){
                    return 'F';
                }else if(x[i][j+1]=='1'&&x[i+1][j]=='1'&&x[i-1][j+1]=='1'){
                    return 'G';
                }
            }
        }
    }
    return 'Z';
}