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)
		fmt.Scanln()
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	char dp[8][8];
	char a='X';
	while(cin>>dp[0][0]){
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(i!=0||j!=0)
			    cin>>dp[i][j];
		}
	}
	for(int i=0;i<8-1;i++){
		for(int j=0;j<8-1;j++){
			if(dp[i][j]=='1'&&dp[i][j+1]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1')
				a='A';
		}
	}
	for(int i=0;i<8-3;i++){
		for(int j=0;j<8;j++){
			if(dp[i][j]=='1'&&dp[i+1][j]=='1'&&dp[i+2][j]=='1'&&dp[i+3][j]=='1')
				a='B';
		}
	}
	for(int i=0;i<8;i++){
		for(int j=0;j<8-3;j++){
			if(dp[i][j]=='1'&&dp[i][j+1]=='1'&&dp[i][j+2]=='1'&&dp[i][j+3]=='1')
				a='C';
		}
	}
	for(int i=0;i<8-2;i++){
		for(int j=0;j<8-1;j++){
			if(dp[i][j+1]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1'&&dp[i+2][j]=='1')
				a='D';
		}
	}
	for(int i=0;i<8-1;i++){
		for(int j=0;j<8-2;j++){
			if(dp[i][j]=='1'&&dp[i][j+1]=='1'&&dp[i+1][j+1]=='1'&&dp[i+1][j+2]=='1')
				a='E';
		}
	}
	for(int i=0;i<8-2;i++){
		for(int j=0;j<8-1;j++){
			if(dp[i][j]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1'&&dp[i+2][j+1]=='1')
				a='F';
		}
	}
	for(int i=0;i<8-1;i++){
		for(int j=0;j<8-2;j++){
			if(dp[i][j+1]=='1'&&dp[i][j+2]=='1'&&dp[i+1][j]=='1'&&dp[i+1][j+1]=='1')
				a='G';
		}
	}
	cout<<a<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
int main() {
  char c[11][11];
  vector<int> v;
  int dat[7][6]={{1,1,1,1,0,0},{1,0,1,0,1,0},{1,1,0,0,0,0},{1,0,1,0,0,0},{1,1,0,1,0,0},
  {1,0,1,1,0,1},{1,1,1,0,0,0}};
  int i,j,k,x,y,f;
  while(true) {
      f=0;
	  for (i=0;i<8;i++) {
		  if (gets(c[i])==NULL) { i=10; break;}
		  if (f==0) for (j=0;j<8;j++) if (c[i][j]=='1') { f=1; x=j; y=i; j=9;}
	  }
	  if (i==10) break;
	  cout << endl;
	  for (k=0;k<7;k++) {
		  f=0;
		  for (i=0;i<3;i++) for (j=0;j<2;j++) {
			  if (x+j>7 || y+i>7) { if (dat[k][j+i*2]==0) f++;}  else
				  if (c[y+i][x+j]==('0'+dat[k][j+i*2])) f++;
		  }
		  if (f==6) break;
	  }
	  v.push_back(k);
  }
  for (i=0;i<v.size();i++) cout << (char)('A'+v[i]) << endl;
  return 0;
}

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

int main(){
	char n[12][12];
	char figure[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"}
	};

	for(int i=0; i<12; i++)
		for(int j=0; j<12; j++)
			n[i][j]='0';
	
	while(~scanf("%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n%8s\n\n", n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])){

		for(int i=0; i<7; i++){
			for(int j=0; j<8; j++){
				for(int k=0; k<8; k++){
					bool flag=true;
					
					for(int x=0; x<4; x++){
						for(int y=0; y<4; y++){
							if(figure[i][x][y] != n[j+x][k+y]) flag = false;
						}
					}
					
					if(flag){
						cout << (char)('A'+i) << endl;
					}

				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>

#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

int main() {
	char a, c;
	int map[10][10];

	while(cin >> c) {
		if(c == '0' || c== '1') {
			rep(i,10)rep(j,10)
				map[i][j] = 0;

			rep(i,8)rep(j,8) {
				if(!(i + j == 0)) ifs >> c;
				map[i][j] = (int)(c - '0');
			}

			rep(i,8)rep(j,8) {
				if(map[i][j]) {
					if(map[i][j+2])   a = 'C';
					if(map[i+2][j])   a = 'B';
					if(map[i+1][j+1]) a = 'A';
					if(map[i+1][j-1]) a = 'G';
					if(map[i+1][j+2]) a = 'E';
					if(map[i+2][j+1]) a = 'F';
					if(map[i+2][j-1]) a = 'D';
					break;
				}
			}

			cout << a << endl;
		}
	}

	return 0;
}

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

int main(){
	string surface[8];
	while(cin >> surface[0]){
		for(int i = 1; i < 8; i++)cin >> surface[i];
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(surface[i][j] == '1'){
					if(surface[i][j + 1] == '1'){
						if(surface[i][j + 2] == '1'){
							cout << "C" << endl;
							goto fin;
						}else{
							if(surface[i + 1][j] == '1'){
								if(surface[i + 1][j + 1] == '1'){
									cout << "A" << endl;
									goto fin;
								}else{
									cout << "G" << endl;
									goto fin;
								}
							}else{
								cout << "E" << endl;
								goto fin;
							}
						}
					}else{
						if(surface[i + 2][j] == '1'){
							cout << "B" << endl;
							goto fin;
						}else{
							if(surface[i + 1][j + 1] == '1'){
								cout << "F" << endl;
								goto fin;
							}else{
								cout << "D" << endl;
								goto fin;
							}
						}
					}
				}
			}
		}
		fin:;
	}
}