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<cstdio>
#include<iostream>

using namespace std;

int main(void){

	int block[7][3*2]={
		{ 1, 0,  0, 1,  1, 1},
		{ 0, 1,  0, 2,  0, 3},
		{ 1, 0,  2, 0,  3, 0},
		{ 0, 1, -1, 1, -1, 2},
		{ 1, 0,  1, 1,  2, 1},
		{ 0, 1,  1, 1,  1, 2},
		{ 1, 0,  0, 1, -1, 1},
	};
	int field[8][8];
	int ycnt=0,xcnt=0;
	int swit=0,flag;
	int xsta,ysta;
	char inp;

	while(cin>>inp){

		if(inp=='0'){
			field[ycnt][xcnt]=0;
			xcnt++;
		}

		if(inp=='1'){
			field[ycnt][xcnt]=1;
			if(swit==0){
				xsta=xcnt;
				ysta=ycnt;
				swit=1;
			}
			xcnt++;
		}

		if(xcnt==8){
			xcnt=0;
			ycnt++;
		}

		if(ycnt==8){
			xcnt=0;
			ycnt=0;
			swit=0;
			for(int i=0;i<7;i++){
				flag=1;
				for(int j=0;j<6;j+=2){
					if(field[ysta+block[i][j+1]][xsta+block[i][j]]!=1) flag=0;
				}
				if(flag==1){
					cout<<(char)('A'+i)<<endl;
					break;
				}
			}
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
char data[8][8];


struct P{
	P(){};
	P(int a,int b){
		x=a;
		y=b;
	}
	int x,y;
};

bool input(){
	for(int i=0;i<8;i++){
		if( scanf( "%s",data[i] ) == EOF )return false;
	}
	return true;
}
int main(){
	
	while(input()){
		P o=P(-1,-1);
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(data[i][j]=='1'){
					o=P(j,i);
					goto suc;
				}
			}
		}
		suc:;
		{
			for(int i=0;i<2;i++){
				for(int j=0;j<2;j++){
					if(o.y+i>=8 || o.x+j>=8)goto fail1;
					if(data[o.y+i][o.x+j]!='1')goto fail1;
				}
			}
			cout<<"A"<<endl;
			continue;
			fail1:;
		}
		{
			for(int i=0;i<4;i++){
				if(o.y+i>=8)goto fail2;
				if(data[o.y+i][o.x]!='1')goto fail2;
			}
			cout<<"B"<<endl;
			continue;
			fail2:; 
		}
		{
			for(int i=0;i<4;i++){
				if(o.x+i>=8)goto fail3;
				if(data[o.y][o.x+i]!='1')goto fail3;
			}
			cout<<"C"<<endl;
			continue;
			fail3:;
		}
		{
			if(o.y+2>=8 || o.x-1<0)goto fail4;
			if(data[o.y+1][o.x]!='1')goto fail4;
			if(data[o.y+1][o.x-1]!='1')goto fail4;
			if(data[o.y+2][o.x-1]!='1')goto fail4;
			cout<<"D"<<endl;
			continue;
			fail4:;
		}
		{
			if(o.x+2>=8 || o.y+1>=8)goto fail5;
			if(data[o.y][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+1]!='1')goto fail5;
			if(data[o.y+1][o.x+2]!='1')goto fail5;
			cout<<"E"<<endl;
			continue;
			fail5:;
		}
		{
			if(o.x+1>=8 || o.y+2>=8)goto fail6;
			if(data[o.y+1][o.x]!='1')goto fail6;
			if(data[o.y+1][o.x+1]!='1')goto fail6;
			if(data[o.y+2][o.x+1]!='1')goto fail6;
			cout<<"F"<<endl;
			continue;
			fail6:;
		}
		{
			if(o.x!=-1)cout<<"G"<<endl;
		}
	}
}

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

string field[8];

bool ch(int i,int j)
{
	if(field[i][j] == '1') return true;
	return false;
}

bool Check_A(int i,int j)
{
	if(i+1 < 8 && j+1 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j+1))  return true;
	}
	return false;
}

bool Check_B(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i+3,j)) return true;
	}
	return false;
}

bool Check_C(int i,int j)
{
	if(j+1 < 8 && j+2 < 8 && j+3 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i,j+2) && ch(i,j+1)) return true;
	}
	return false;
}

bool Check_D(int i,int j)
{
	if(j-1 > 0 && i+1 < 8 && i+2 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+2,j) && ch(i,j-1)) return true;
	}
	return false;
}

bool Check_E(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j+2 < 8)
	{
		if(ch(i,j) && ch(i,j+1) && ch(i+1,j+1) && ch(i+1,j+2)) return true;
	}
	return false;
}

bool Check_F(int i,int j)
{
	if(i+1 < 8 && i+2 < 8 && i+3 < 8)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i+1,j+1)&& ch(i+2,j+1)) return true;
	}
	return false;
}

bool Check_G(int i,int j)
{
	if(i+1 < 8 && j+1 < 8 && j-1 > 0)
	{
		if(ch(i,j) && ch(i+1,j) && ch(i,j+1) && ch(i+1,j-1)) return true;
	}
	return false;
}

int main()
{
	while(cin >> field[0])
	{
		for(int i=1;i<8;i++)
		{
			cin >> field[i];
		}
		
		bool flag = true;
		for(int i=0;i<8;i++)
		{
			for(int j=0;j<8;j++)
			{
				if(Check_A(i,j) && flag)
				{
					cout << "A" << endl;
					flag = false;
				}

				if(Check_B(i,j) && flag)
				{
					cout << "B" << endl;
					flag = false;
				}

				if(Check_C(i,j) && flag)
				{
					cout << "C" << endl;
					flag = false;
				}

				if(Check_D(i,j) && flag)
				{
					cout << "D" << endl;
					flag = false;
				}				

				if(Check_E(i,j) && flag)
				{
					cout << "E" << endl;
					flag = false;
				}

				if(Check_F(i,j) && flag)
				{
					cout << "F" << endl;
					flag = false;
				}

				if(Check_G(i,j) && flag)
				{
					cout << "G" << endl;
					flag = false;
				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
string s[8];
void f(){
	char b='A';
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(s[i][j]=='1'){
				if(i<5)if(s[i+3][j]=='1')b='B';
				if(j<5)if(s[i][j+3]=='1')b='C';
				if(i<6&&j>0)if(s[i+2][j-1]=='1')b='D';
				if(i<7&&j<6)if(s[i+1][j+2]=='1')b='E';
				if(i<6&&j<7)if(s[i+2][j+1]=='1')b='F';
				if(i<7&&j>0)if(s[i+1][j-1]=='1'&&s[i][j+1])b='G';
				cout<<b<<endl;
				return;
			}
		}
	}
}

int main(){
	while(cin>>s[0]){
		for(int i=1;i<8;i++)cin>>s[i];
		f();
	}
	return 0;
}