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
}

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;
string str[8],tmp;
char ch;
int main(){
  while(cin>>str[0]){
    for(int i=1;i<8;i++)cin>>str[i];
    getline(cin,tmp);
    //11
    //11
    for(int i=0;i<7;i++){
      for(int j=0;j<7;j++){
	if(str[i][j]=='1'&&str[i+1][j]=='1'&&str[i][j+1]=='1'&&str[i+1][j+1]=='1'){
	  ch='A';
	}
      }
    }

    //1
    //1
    //1
    //1
    for(int i=0;i<5;i++){
      for(int j=0;j<8;j++){
	if(str[i][j]=='1'&&str[i+1][j]=='1'&&str[i+2][j]=='1'&&str[i+3][j]=='1')ch='B';
      }
    }
    
    //1111
    for(int i=0;i<8;i++){
      for(int j=0;j<5;j++){
	if(str[i][j]=='1'&&str[i][j+1]=='1'&&str[i][j+2]=='1'&&str[i][j+3]=='1')ch='C';
      }
    }
    
    //01
    //11
    //10
    for(int i=0;i<6;i++){
      for(int j=0;j<7;j++){
	if(str[i][j+1]=='1'&&str[i+1][j]=='1'&&str[i+1][j+1]=='1'&&str[i+2][j]=='1')ch='D';
      }
    }
    
    //110
    //011
    for(int i=0;i<7;i++){
      for(int j=0;j<6;j++){
	if(str[i][j]=='1'&&str[i][j+1]=='1'&&str[i+1][j+1]=='1'&&str[i+1][j+2]=='1')ch='E';
      }
    }
    
    //011
    //110
    for(int i=0;i<7;i++){
      for(int j=0;j<6;j++){
	if(str[i][j+1]=='1'&&str[i][j+2]=='1'&&str[i+1][j]=='1'&&str[i+1][j+1]=='1')ch='G';
      }
    }

    //10
    //11
    //01
    for(int i=0;i<6;i++){
      for(int j=0;j<7;j++){
	if(str[i][j]=='1'&&str[i+1][j]=='1'&&str[i+1][j+1]=='1'&&str[i+2][j+1]=='1')ch='F';
      }
    }

    cout<<ch<<endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	char input[8][8];
	int line;
	int zero;
	int tmp;
	bool flag;
	bool is,end;
	while(gets(input[0])){
		for(int i=1;i<8;i++)
			gets(input[i]);
		line=0;
		zero=0;
		flag=false;
		end=false;
		for(int i=0;i<8;i++){
			is=false;
			for(int j=0;j<8;j++){
				if(input[i][j]=='1'){
					is=true;
					flag=true;
					if(zero)
						end=true;
				}
				if(flag&&!end){
					if(input[i][j]=='0')
						zero++;
				}	
			}
			if(is)
				line++;
		}
		if(line==4)
			cout<<"B"<<endl;
		else if(line==1)
			cout<<"C"<<endl;
		else if(line==2){
			if(zero==6)
				cout<<"A"<<endl;
			else if(zero==7)
				cout<<"E"<<endl;
			else if(zero==5)
				cout<<"G"<<endl;
		}else{
			if(zero==7)
				cout<<"F"<<endl;
			else
				cout<<"D"<<endl;
		}
	}
}

C++: 
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j,k;
  int n=8;
  vector<string> s;
  string t;
  while(cin>>t)s.push_back(t);

  rep(i,s.size()){
    for(j=i;j<i+n;j++)rep(k,n)if(s[j][k]=='1'){
	if(j+1<i+n && k+1<n && s[j][k+1]=='1' && s[j+1][k]=='1' && s[j+1][k+1]=='1')
	  cout<<"A"<<endl;
	if(j+3<i+n && s[j+1][k]=='1' && s[j+2][k]=='1' && s[j+3][k]=='1')
	  cout<<"B"<<endl;
	if(k+3<n && s[j][k+1]=='1' && s[j][k+2]=='1' && s[j][k+3]=='1')
	  cout<<"C"<<endl;
	if(j+2<i+n && k!=0 && s[j+1][k]=='1' && s[j+1][k-1]=='1' && s[j+2][k-1]=='1')
	  cout<<"D"<<endl;
	if(j+1<i+n && k+2<n && s[j][k+1]=='1' && s[j+1][k+1]=='1' && s[j+1][k+2]=='1')
	  cout<<"E"<<endl;
	if(j+2<i+n && k+1<n && s[j+1][k]=='1' && s[j+1][k+1]=='1' && s[j+2][k+1]=='1')
	  cout<<"F"<<endl;
	if(j+1<n+i && k && k+1<n && s[j][k+1]=='1' && s[j+1][k]=='1' && s[j+1][k-1]=='1')
	  cout<<"G"<<endl;
	goto END;
      }
  END:i+=n-1;
  }
}

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

int main()
{
    std::string figure[] = {
        "1100000011",
        "1000000010000000100000001",
        "1111",
        "1000000110000001",
        "11000000011",
        "100000001100000001",
        "110000011"
    };

    while (true) {
        std::string s = "", tmp;
        for (int i = 0; i < 8; ++i) {
            getline(std::cin, tmp);
            s += tmp;
        }
        if (std::cin.eof()) break;

        for (int i = 0; i < 7; ++i) {
            if (s.find(figure[i]) != std::string::npos) {
                std::cout << static_cast<char>(i + 'A') << std::endl;
                break;
            }
        }
    }
}

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

char map[8][8];
 
void check(void)
{
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      if (map[i][j] == '1'){
        if (map[i][j + 1] == '1' && map[i + 1][j] == '1' && map[i + 1][j + 1] == '1'){
          puts("A");
        }
        else if (map[i + 1][j] == '1' && map[i + 2][j] == '1' && map[i + 3][j] == '1'){
          puts("B");
        }
        else if (map[i][j + 1] == '1' && map[i][j + 2] == '1' && map[i][j + 3] == '1'){
          puts("C");
        }
        else if (map[i + 1][j] == '1' && map[i + 1][j - 1] == '1' && map[i + 2][j - 1] == '1'){
          puts("D");
        }
        else if (map[i][j + 1] == '1' && map[i + 1][j + 1] == '1' && map[i + 1][j + 2] == '1'){
          puts("E");
        }
        else if (map[i + 1][j] == '1' && map[i + 1][j + 1] == '1' && map[i + 2][j + 1] == '1'){
          puts("F");
        }
        else if (map[i][j + 1] == '1' && map[i + 1][j] == '1' && map[i + 1][j - 1] == '1'){
          puts("G");
        }
      }
    }
  }
} 
int main()
{
    while (scanf(" %c", &map[0][0]) != EOF){
      for (int i = 1; i < 8; i++){
        scanf(" %c", &map[0][i]);
      }   
      for (int i = 1; i < 8; i++){
        for (int j = 0; j < 8; j++){
          scanf(" %c", &map[i][j]);
        }
      }     
      check();
    }
    return (0);
}