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

using namespace std;

/** Problem0036 : A Figure on Surface **/
int main()
{
	char board[8][9];
	
	while (1) {
		for (int i=0; i<8; i++)
			for (int j=0; j<8; j++)
				cin >> board[i][j];
		
		if (cin.eof()) break;
		
		for (int y=0; y<8; y++) {
			for (int x=0; x<8; x++) {
				if (board[y][x] == '1') {
					if (board[y][x+1] == '1' && board[y+1][x] == '1' && board[y+1][x+1] == '1')
						cout << "A" << endl;
					else if (board[y+1][x] == '1' && board[y+2][x] == '1' && board[y+3][x] == '1')
						cout << "B" << endl;
					else if (board[y][x+1] == '1' && board[y][x+2] == '1' && board[y][x+3] == '1')
						cout << "C" << endl;
					else if (board[y+1][x] == '1' && board[y+1][x-1] == '1' && board[y+2][x-1] == '1')
						cout << "D" << endl;
					else if (board[y][x+1] == '1' && board[y+1][x+1] == '1' && board[y+1][x+2] == '1')
						cout << "E" << endl;
					else if (board[y+1][x] == '1' && board[y+1][x+1] == '1' && board[y+2][x+1] == '1')
						cout << "F" << endl;
					else
						cout << "G" << endl;
					goto endloop;
				}
			}
		}
	endloop:
		;
	}
	
	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;
	
	}
	
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;
typedef pair<double,double> P;




int main(){
	int field[8][8];
	string field1[8];
	
	while(cin >> field1[0]){
		for(int i = 1;i < 8;i++){
			cin >> field1[i];
		}
		for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				if(field1[i][j] == '1') field[i][j] = 1;
				else field[i][j] = 0;
			}
		}
		/*for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				cout << field[i][j];
			}
			cout << endl;
		}
		cout << endl;*/
		for(int i = 0;i < 8;i++){
			int flag = 0;
			for(int j = 0;j < 8;j++){
				if(field[i][j] == 1){
					//cout << i << j <<endl;
					if(field[i][j+1] == 1){
						if(field[i+1][j] == 1){
							if(field[i+1][j+1] == 1){
								cout << "A" << endl;
								flag = 1;break;
							}
							else if(field[i+1][j-1] == 1){
								cout << "G" << endl;
								flag = 1;break;
							}
						}
						else if(field[i][j+2] == 1 && field[i][j+3] == 1){
							cout << "C" << endl;
							flag = 1;break;
						}
						else if(field[i+1][j+1] == 1 && field[i+1][j+2] == 1){
							cout << "E" << endl;
							flag = 1;break;
						}
					}
					else if(field[i+1][j] == 1){
						if(field[i+1][j-1] == 1 && field[i+2][j-1] == 1){
							cout << "D" << endl;
							flag = 1;break;
						}
						else if(field[i+1][j+1] == 1 && field[i+2][j+1] == 1){
							cout << "F" << endl;
							flag = 1;break;
						}
					}
					else if(field[i+1][j] == 1 && field[i+2][j] == 1 && field[i+3][j] == 1){
						cout << "B" << endl;
						flag = 1;break;
					}
				}
			}
			if(flag == 1) break;
		}
	}

	return 0;
}

C++: #include<cstdio>

using namespace std;

int main(void){
	char in[8][8];
	int i,j,flag=0,out=0,y,x;

	while(1){
		for(i=0;i<8;i++){
			if(scanf("%s",in[i])==EOF)	flag=1;
			if(flag==1)	break;
		}
		if(flag==1)	break;

		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				if(in[i][j]=='1'){
					y=i;
					x=j;
					out=1;
					break;
				}
			}
			if(out==1)	break;
		}
		out=0;

		if(in[y][x+1]=='1' && in[y+1][x]=='1' && in[y+1][x+1]=='1')	printf("A\n");
		if(in[y+1][x]=='1' && in[y+2][x]=='1' && in[y+3][x]=='1')	printf("B\n");
		if(in[y][x+1]=='1' && in[y][x+2]=='1' && in[y][x+3]=='1')	printf("C\n");
		if(in[y+1][x-1]=='1' && in[y+1][x]=='1' && in[y+2][x-1]=='1')	printf("D\n");
		if(in[y][x+1]=='1' && in[y+1][x+1]=='1' && in[y+1][x+2]=='1')	printf("E\n");
		if(in[y+1][x]=='1' && in[y+1][x+1]=='1' && in[y+2][x+1]=='1')	printf("F\n");
		if(in[y][x+1]=='1' && in[y+1][x-1]=='1' && in[y+1][x]=='1')	printf("G\n");
	}

	return 0;
}