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<vector>
using namespace std;
char tetromino_figure(vector<string> v){
	for(int i = 0; i < 8; i++){
		for(int j = 0; j < 8; j++){
			if(v[i][j] == '1'){
				if(v[i][j + 1] == '1' && v[i + 1][j] == '1' && v[i + 1][j + 1] == '1') return 'A';
				if(v[i + 1][j] == '1' && v[i + 2][j] == '1' && v[i + 3][j] == '1') return 'B';
				if(v[i][j + 1] == '1' && v[i][j + 2] == '1' && v[i][j + 3] == '1') return 'C';
				if(v[i + 1][j - 1] == '1' && v[i + 1][j] == '1' && v[i + 2][j - 1] == '1') return 'D';
				if(v[i][j + 1] == '1' && v[i + 1][j + 1] == '1' && v[i + 1][j + 2] == '1') return 'E';
				if(v[i + 1][j] == '1' && v[i + 1][j + 1] == '1' && v[i + 2][j + 1] == '1') return 'F';
				if(v[i][j + 1] == '1' && v[i + 1][j - 1] == '1' && v[i + 1][j] == '1') return 'G';
			}
		}
	}
	return '0';
}
int main(){
	string s;
	while(cin >> s){
		if(s == "\n") continue;
		vector<string> v;
		for(int i = 1; i <= 3; i++) s += '0';
		v.push_back(s);
		for(int i = 2; i <= 8; i++){
			cin >> s;
			for(int j = 1; j <= 3; j++) s += '0';
			v.push_back(s);
		}
		for(int i = 1; i <= 3; i++) v.push_back("00000000000");
		cout << tetromino_figure(v) << endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define INF (1<<29)
#define EPS (1e-10)
#define make_pair mp
#define pb push_bacck

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;

int dx[] = {0,1,0,-1}, dy[] = {1,0,-1,0};
int bx[7][4] = {
							{0,1,0,1},
							{0,0,0,0},
							{0,1,2,3},
							{1,0,1,0},
							{0,1,1,2},
							{0,0,1,1},
							{1,2,0,1}};
int by[7][4] = {
							{0,0,1,1},
							{0,1,2,3},
							{0,0,0,0},
							{0,1,1,2},
							{0,0,1,1},
							{0,1,1,2},
							{0,0,1,1}};

int main(){
	string board[8];
	string line;
	int l = 0;
	while (cin >> line) {
		board[l] = line;
		if (++l == 8) {
			for (int i = 0; i < 8; i++) {
				for (int j = 0; j < 8; j++) {
					for (int k = 0; k < sizeof(bx); k++) {
						bool ok = true;
						for (int l = 0; l < 4; l++) {
							int x = j+bx[k][l], y = i+by[k][l];
							if (x < 0 || 8 <= x || y < 0 || 8 <= y || board[y][x] != '1'){
								ok = false;
								break;
							}
						}
						if (ok) {
							cout << char('A'+k) << endl;
							goto end;
						}
					}
				}
			}
			end:;
			l = 0;
		}
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int cnt=0;
string  w[8], ans;

	while(!cin.eof()){
		ans = "?";
		rep(i,8) rep(j,8) cin >> w[i][j];
		if(cin.eof()) break;
		rep(i,8) rep(j,8) if(w[i][j] == '1'){
			if(w[i][j+1] =='1' && w[i+1][j+1]=='1' &&  w[i+1][j]=='1' ){
				ans = "A";  break; }
			if(w[i+1][j]=='1' && w[i+2][j]=='1' && w[i+3][j]=='1' ){
				ans = "B";  break; }
			if(w[i][j+1]=='1' &&  w[i][j+2]=='1' && w[i][j+3]=='1'){
				ans = "C";  break; }
			if(w[i+1][j-1]=='1' && w[i+1][j]=='1' && w[i+2][j-1]=='1'){
				ans = "D";  break; }
			if(w[i][j+1]=='1' && w[i+1][j+1]=='1' && w[i+1][j+2]=='1'){
				ans = "E";  break; }
			if(w[i+1][j]=='1' && w[i+1][j+1]=='1' && w[i+2][j+1]=='1'){
				ans = "F";  break; }
			if(w[i][j+1]=='1' && w[i+1][j-1]=='1' && w[i+1][j]=='1' ){
				ans = "G";  break; }
			}
		cout <<  ans << endl;
//		cnt++; if(cnt>40) break;
	}
	return 0;
	
	
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	char f[8][8];
	int x,y,i,j;
	while(1)
	{
		x=y=-1;
		for(i=0;i<8;i++)cin >> f[i];
		if(cin.eof())break;
		for(x=0;x<8;x++)
		{
			for(y=0;y<8;y++)
			{
				if(f[x][y]=='1')
				{
					i=x;
					j=y;
					break;
				}
			}
			if(i==x&&j==y)break;
		}
		if(i<7&&j<7&&f[i+1][j]=='1'&&f[i][j+1]=='1'&&f[i+1][j+1]=='1')printf("A\n");
		else if(i<5&&f[i+3][j]=='1')printf("B\n");
		else if(j<5&&f[i][j+3]=='1')printf("C\n");
		else if(i<6&&j>0&&f[i+2][j-1]=='1')printf("D\n");
		else if(i<7&&j<6&&f[i+1][j+2]=='1')printf("E\n");
		else if(i<6&&j<7&&f[i+2][j+1]=='1')printf("F\n");
		else if(i<7&&j<7&&j>0&&f[i][j+1]=='1'&&f[i+1][j-1]=='1')printf("G\n");
	}
	return 0;
}