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(), "")
		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 <bits/stdc++.h>
using namespace std;

double eps = 1e-10;

int main() {
	string s[16];
	while(cin >> s[0]){
		for(int i = 1; i < 8; ++i){
			cin >> s[i];
		}
		int h, w;
		for(int i = 0; i < 8; ++i){
			for(int j = 0; j < 8; ++j){
				if(s[i][j] == '1'){
					h = i;
					w = j;
					goto next;
				}
			}
		}
		next:;
		if(s[h + 1][w] == '1' && s[h][w + 1] == '1' && s[h + 1][w + 1] == '1'){
			cout << "A" << endl;
		}
		else if(s[h + 1][w] == '1' && s[h + 2][w] == '1' && s[h + 3][w] == '1'){
			cout << "B" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h][w + 2] == '1' && s[h][w + 3] == '1'){
			cout << "C" << endl;
		}
		else if(s[h + 1][w - 1] == '1' && s[h + 1][w] == '1' && s[h + 2][w - 1] == '1'){
			cout << "D" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h + 1][w + 1] == '1' && s[h + 1][w + 2] == '1'){
			cout << "E" << endl;
		}
		else if(s[h + 1][w] == '1' && s[h + 1][w + 1] == '1' && s[h + 2][w + 1] == '1'){
			cout << "F" << endl;
		}
		else if(s[h][w + 1] == '1' && s[h + 1][w] == '1' && s[h + 1][w - 1] == '1'){
			cout << "G" << endl;
		}
	}
	return 0;
}

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

char m[8][8];
void figure(int, int);

int main() {

	while(1) {
		bool f = true;
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				cin >> m[i][j];
				if(cin.eof()) {
					return 0;
				}
			}
		}
		for(int i = 0; i < 8; i++) {
			for(int j = 0; j < 8; j++) {
				if(m[i][j] == '1') {
					figure(i, j);
					f = false;
					break;
				}
			}
			if(!f) {
				break;
			}
		}
	}
}


void figure(int i, int j) {
	char s;
	if(m[i][j+1] == '1' && m[i+1][j+1]== '1' && m[i+1][j]== '1') {
		s = 'A';
	}
	else if(m[i+1][j] == '1' && m[i+2][j] == '1') {
		s = 'B';
	}
	else if(m[i][j+1] == '1' && m[i][j+2] == '1') {
		s = 'C';
	}
	else if(m[i][j+1] == '1' && m[i+1][j+1] == '1') {
		s = 'E';
	}
	else if(m[i][j+1] == '1') {
		s = 'G';
	}
	else if(m[i+1][j+1] == '1') {
		s = 'F';
	}
	else {
		s = 'D';
	}
	cout << s << endl;
}

C++: #include <stdio.h>
int main() {
    int RB[8][8],i,j;while (scanf("%1d",&RB[0][0])!=EOF) {for (i=1;i<8;scanf("%1d",&RB[0][i++]));for (i=1;i<8;i++) for (j=0;j<8;scanf("%1d",&RB[i][j++]));
        for (i=0;i<8;i++) for (j=0;j<8;j++) if (RB[i][j]) {if (j<=4 && RB[i][j+1]*RB[i][j+2]*RB[i][j+3]) puts("C"); else if (i<=4 && RB[i+1][j]*RB[i+2][j]*RB[i+3][j]) puts("B"); else if (i<7 && j<7) {
            if (RB[i+1][j]*RB[i][j+1]) puts("A"); else if (RB[i+2][j+1]) puts("F"); else puts("E");} else if (j<7 && RB[i][j+1]) puts("G"); else puts("D"); i=10,j=10;}}return 0;}

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

using namespace std;

#define ROW 8
#define COLUMN 8

void get_ans( string *matrix_str , char& ans );

int main(void)
{
	int matrix[ROW][COLUMN];
	string matrix_str[COLUMN];
	char c;

	while(1)
	{
		char ans = '0';
		int flag = 0; // 二重ループ脱出用
		for( int i = 0 ; i < COLUMN ; i++ )
		{
			cin >> matrix_str[i];
			if( cin.eof() )
			{
				flag = 1;
				break;
			}
		}
		if( flag == 1 )
		{
			break;
		}
		get_ans( matrix_str , ans );
		cout << ans << endl;
	}

	return 0;
}

void get_ans( string *matrix_str , char& ans )
{
	for( int i = 0 ; i < ROW ; i++ )
	{
		for( int j = 0 ; j < COLUMN ; j++ )
		{
			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+1].at(j+1) == '1' )
			{
				ans = 'A';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+2].at(j) == '1' &&
				matrix_str[i+3].at(j) == '1' )
			{
				ans = 'B';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i].at(j+2) == '1' &&
				matrix_str[i].at(j+3) == '1' )
			{
				ans = 'C';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j-1) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+2].at(j-1) == '1' )
			{
				ans = 'D';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j+1) == '1' &&
				matrix_str[i+1].at(j+2) == '1' )
			{
				ans = 'E';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i+1].at(j) == '1' &&
				matrix_str[i+1].at(j+1) == '1' &&
				matrix_str[i+2].at(j+1) == '1' )
			{
				ans = 'F';
			}

			if( matrix_str[i].at(j) == '1' &&
				matrix_str[i].at(j+1) == '1' &&
				matrix_str[i+1].at(j-1) == '1' &&
				matrix_str[i+1].at(j) == '1' )
			{
				ans = 'G';
			}
		}
	}
	return;
}

C++: #include <iostream>

#define limit(A,X,C) ((X<A)?A:(C<X)?C:X)

char map[8+1][8]={'0'};

int pget(int x,int y)
{
	if(limit(0,x,7)==x && limit(0,y,7)==y)
		return map[y][x]-'0';
	return 0;
}

char check(int x, int y)
{
//	std::cout << ":" << x << y << std::endl;
	if(pget(x+1,y))
	{
		if(pget(x+2,y))
			return 'C';
		if(!pget(x,y+1))
			return 'E';
		if(pget(x+1,y+1))
			return 'A';
		return 'G';
	}
	if(pget(x,y+2))
		return 'B';
	if(pget(x+1,y+2))
		return 'F';
	return 'D';
}

int main(void)
{
	do
	{
		for(int i=0; i<8; i++)
			if(!(std::cin >> map[i]))
				return 0;
		int x,y;
		bool end=false;
		for(y=0; y<8; y++)
		{
			for(x=0; x<8; x++)
				if(map[y][x] == '1')
				{
					end=true;
					break;
				}
			if(end)
				break;
		}

		std::cout << check(x,y) << std::endl;
	}while(std::cin.getline(map[0],sizeof(map[0])));
	
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
string s[8];
void f(){
	char b='A';
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(s[i][j]=='1'){
				if(i<5)if(s[i+3][j]=='1')b='B';
				if(j<5)if(s[i][j+3]=='1')b='C';
				if(i<6&&j>0)if(s[i+2][j-1]=='1')b='D';
				if(j<6)if(s[i+1][j+2]=='1')b='E';
				if(i<6)if(s[i+2][j+1]=='1')b='F';
				if(j>0)if(s[i+1][j-1]=='1')b='G';
				cout<<b<<endl;
				return;
			}
		}
	}
}

int main(){
	while(cin>>s[0]){
		for(int i=1;i<8;i++)cin>>s[i];
		f();
	}
	return 0;
}