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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; 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 < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 < 8; i++ {
			for j := 0; j < 8; 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 <cstdio>

using namespace std;

char field[8][8];

bool check(int y,int x){
	return 0<=y && y<8 && 0<=x && x<8 && field[y][x];
}

int main(void){
	int i,j,y,x;

	while(cin>>field[0]){
		for(i=1;i<8;i++){
			cin>>field[i];
		}

		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				field[i][j]-='0';
			}
		}

		for(y=0;y<8;y++){
			for(x=0;x<8;x++){
				if(field[y][x]==1){
					if(check(y+1,x) && check(y+2,x)) cout<<"B"<<endl;
					else if(check(y,x+1) && check(y,x+2)) cout<<"C"<<endl;
					else if(check(y+1,x) && check(y,x+1) && check(y+1,x+1)) cout<<"A"<<endl;
					else if(check(y+1,x) && check(y+1,x-1) && check(y+2,x-1)) cout<<"D"<<endl;
					else if(check(y,x+1) && check(y+1,x+1) && check(y+1,x+2)) cout<<"E"<<endl;
					else if(check(y+1,x) && check(y+1,x+1) && check(y+2,x+1)) cout<<"F"<<endl;
					else if(check(y,x+1) && check(y+1,x) && check(y+1,x-1)) cout<<"G"<<endl;
					y=x=8;
				}
			}
		}
	}
	return 0;
}

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

int main(){
  bool bmap[10][10],fin = false;
  char s[10];
  while(true){
    for(int i=1;i<=8;i++){
      if(scanf("%s",s) == EOF){
	fin = true;
	break;
      }
      for(int j=0;j<8;j++){
	if(s[j] == '0')bmap[i][j+1] = false;
	else bmap[i][j+1] = true;
      }
    }
    if(fin)break;
    for(int i=1;i<=8;i++){
      for(int j=1;j<=8;j++){
	if(bmap[i][j]){
	  if(j+1<= 8 && i+1<=8 &&bmap[i][j+1] && bmap[i+1][j] && bmap[i+1][j+1]){
	    cout << "A" << endl; break;
	  }
	  else if(i+3<=8 && bmap[i+1][j] && bmap[i+2][j] && bmap[i+3][j]){
	    cout << "B" << endl; break;
	  }
	  else if(j+3<=8 && bmap[i][j+1] && bmap[i][j+2] && bmap[i][j+3]){
	    cout << "C" << endl; break;
	  }
	  else if(i+2<=8 && 1<=j-1 && bmap[i+1][j] && bmap[i+1][j-1] && bmap[i+2][j-1]){
	    cout << "D" << endl; break;
	  }
	  else if(i+1<=8 && j+2<=8 && bmap[i][j+1] && bmap[i+1][j+1] && bmap[i+1][j+2]){
	    cout << "E" << endl; break;
	  }
	  else if(i+2<=8 && j+1<=8 && bmap[i+1][j] && bmap[i+1][j+1] && bmap[i+2][j+1]){
	    cout << "F" << endl; break;
	  }
	  else if(i+1<=8 && 1<=j-1 && j+1<=8 && bmap[i][j+1] && bmap[i+1][j] && bmap[i+1][j-1]){
	    cout << "G" << endl; break;
	  }
	}
      }
    }
  
  }
  return 0;
}

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

using namespace std;
string str[8]; 
void ans(int i,int k){
	if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k] == '1' ){
		cout << "A" << endl;  
		} else if(str[i+1][k] == '1' && str[i+2][k] == '1'&& str[i+3][k] == '1' ){
		cout << "B" << endl; 
		} else if(str[i][k+1] == '1' && str[i][k+2] == '1'&& str[i][k+3] == '1' ){
		cout << "C" << endl;  
		} else if(str[i+1][k] == '1' && str[i+1][k-1] == '1'&& str[i+2][k-1] == '1' ){
		cout << "D" << endl; 
		} else if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k+2] == '1' ){
		cout << "E" << endl; 
		} else if(str[i+1][k] == '1' && str[i+1][k+1] == '1'&& str[i+2][k+1] == '1' ){
		cout << "F" << endl;  
		} else if(str[i][k+1] == '1' && str[i+1][k] == '1'&& str[i+1][k-1] == '1' ){
		cout << "G" << endl; 
		}



}

int main(){
	
	while(1){
	
	for(int i =0;i<8;i++)
		cin >> str[i];
	
	
	for(int i=0;i<64;i++)
	
	if(str[i/8][i%8] == '1')
	ans(i/8,i%8);
	
	if (!getline(cin, str[0]))
    break;
	
	}
	
}

C++: #include<iostream>
using namespace std;
typedef unsigned long long ull;
int main(){
	int shape[7]={0x0303,0x01010101,0x0f,
		0x010302,0x0603,0x020301,0x0306};
	char c;
	int ans;
	while(cin>>c){
		ull mass=c-'0';	
		for(int i=1;i<64;i++){
			cin>>c;
			if(c=='1')mass |= (ull)1<<i; 
		}
		for(int i=0;i<64;i++){
			for(int j=0;j<7;j++){
				if((mass>>i&shape[j])==shape[j])ans=j;
			}
		}
		cout<<(char)(ans+'A')<<endl;
	}
	return 0;
}

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

string M[15];

int main() {

  while(cin>>M[0]) {
    for(int i=1; i<8; i++) cin >> M[i];
    
    char res = '#';
    
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(M[i][j]-'0') {
	  
	  if(M[i+1][j+1]-'0') {
	    if(M[i+2][j+1]-'0') {
	      res = 'F'; goto end;
	    } else if(M[i+1][j+2]-'0') {
	      res = 'E'; goto end;
	    } else {
	      res = 'A'; goto end;
	    }
	  }
	  
	  if(M[i+3][j]-'0') {
	    res = 'B'; goto end;
	  }

	  if(M[i][j+3]-'0') {
	    res = 'C'; goto end;
	  }

	  if(M[i-1][j+2]-'0') {
	    res = 'D'; goto end;
	  }

	  if(M[i+1][j-1]-'0') {
	    res = 'G'; goto end;
	  }
	  
	}
      }
    }
    end:
    cout << res << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#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;
		v.push_back(s);
		for(int i = 2; i <= 8; i++){
			cin >> s;
			v.push_back(s);
		}
		cout << tetromino_figure(v) << endl;
	}
	return 0;
}