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 < 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 <cstdio>
using namespace std;

int main(){
	int ax, ay;
	char f[12][12];
	bool flag = false;

	for(int y=0 ; y<12 ; y++){
		for(int x=0 ; x<12 ; x++){
			f[y][x] = 0;
		}
	}

	while( 1 ){
		for(int i=0 ; i<8 ; i++) {
			if( scanf("%s", f[i]) == EOF ){
				flag = true;
				break;
			}
		}
		if(flag) break;

		for(int i=0 ; i<64 ; i++){
			if(f[i/8][i%8]=='1'){
				ax = i%8;
				ay = i/8;
				break;
			}
		}
		if( f[ay+1][ax]=='1' && f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' ){
			printf("A\n");
		}else if( f[ay+1][ax]=='1' && f[ay+2][ax]=='1' && f[ay+3][ax]=='1' ){
			printf("B\n");
		}else if( f[ay][ax+1]=='1' && f[ay][ax+2]=='1' && f[ay][ax+3]=='1' ){
			printf("C\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' && f[ay+1][ax+2]=='1' ){
			printf("E\n");
		}else if( f[ay+1][ax]=='1' && f[ay+1][ax+1]=='1' && f[ay+2][ax+1]=='1' ){
			printf("F\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("G\n");
		}else if( f[ay+2][ax-1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("D\n");
		}
	}
}

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

using namespace std;

char ret;

int main()
{

	string s;
	while(cin>>s){
	
	
	for(int i=1;i<8;i++){
		string s_tmp;
		cin>>s_tmp;
		s += s_tmp;
	}
	
	// 2次元配列を1次元的に処理
	for(int i=0;i<8*8;i++){
		if(s[i]=='1'){
			// Aかどうか
			if(s[i+1]=='1' && s[i+8]=='1' && s[i+9]=='1'){
				ret = 'A';
				break;
			}else if(s[i+8]=='1' && s[i+16]=='1' && s[i+24]=='1'){
				ret = 'B';
				break;
			}else if(s[i+1]=='1' && s[i+2]=='1' && s[i+3]=='1'){
				ret = 'C';
				break;
			}else if(s[i+7]=='1' && s[i+8]=='1' && s[i+15]=='1'){
				ret = 'D';
				break;
			}else if(s[i+1]=='1' && s[i+9]=='1' && s[i+10]=='1'){
				ret = 'E';
				break;
			}else if(s[i+8]=='1' && s[i+9]=='1' && s[i+17]=='1'){
				ret = 'F';
				break;
			}else if(s[i+1]=='1' && s[i+7]=='1' && s[i+8]=='1'){
				ret = 'G';
				break;
			}
		}
	}
	
	cout<<ret<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;int main(){int b[5][4];int sx,sy;int x,y;string line;while(true){for(int i=0;i<20;i++)b[i%5][i/5]=0;sx=sy=-1;for(y=0;y<8;y++){if (!(cin>>line))break;for(x=0;x<8;x++){if (line[x]=='1'){if (sy==-1){sx=x-1;sy=y;}b[x-sx][y-sy] = 1;}}}if (y<8)break;char a;if(b[2][0]&&b[1][1]&&b[2][1])a='A';if(b[1][3])a='B';if(b[4][0])a="C";if(b[0][2])a="D";if(b[3][1])a="E";if(b[2][2])a="F";if(b[0][1]&&b[2][0])a="G";cout<<a<<endl;}}

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

int main(void){
	string s[8];
	while(cin>>s[0]){
		std::vector<pair<int,int> > v;
		for(int i=1;i<8;i++)cin>>s[i];
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(s[i][j]=='1')v.push_back(make_pair(i,j));
			}
		}
		// second=x,first=y
		if(v[0].first==v[1].first&&v[0].second==v[2].second)cout<<"A"<<endl;
		else if(v[0].second==v[1].second&&v[2].second==v[1].second&&v[2].second==v[3].second)cout<<"B"<<endl;
		else if(v[2].first==v[0].first)cout<<"C"<<endl;
		else if(make_pair(v[0].first+2,v[0].second-1)==v[3])cout<<"D"<<endl;
		else if(make_pair(v[0].first+1,v[0].second+2)==v[3])cout<<"E"<<endl;
		else if(make_pair(v[0].first+2,v[0].second+1)==v[3])cout<<"F"<<endl;
		else cout<<"G"<<endl;
		// cin>>s[0]; // CRLF
	}
}

C++: #include<iostream>
using namespace std;
int dax[]={1,0,1};
int day[]={0,1,1};
int dbx[]={0,0,0};
int dby[]={1,2,3};
int dcx[]={1,2,3};
int dcy[]={0,0,0};
int ddx[]={0,-1,-1};
int ddy[]={1,1,2};
int dex[]={1,1,2};
int dey[]={0,1,1};
int dfx[]={0,1,1};
int dfy[]={1,1,2};
int dgx[]={1,0,-1};
int dgy[]={0,1,1};

int main()
{
	char f[10][10];

	while(cin>>f[0][0])
	{
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; j++)
			{
				if(i==0&&j==0) continue;
				cin>>f[i][j];
			}
		}
		/*cout<<"Complete!"<<endl;
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; j++)
			{
				cout<<f[i][j];
			}
			cout<<endl;
		}
*/
		bool flag=false;
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 8; ++j)
			{
				if(f[i][j]=='1')
				{
					for(int k = 0; k < 3; ++k)
					{
						if(j+dax[k]<0||j+dax[k]>7||i+day[k]<0||i+day[k]>7||f[i+day[k]][j+dax[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"A"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dbx[k]<0||j+dbx[k]>7||i+dby[k]<0||i+dby[k]>7||f[i+dby[k]][j+dbx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"B"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dcx[k]<0||j+dcx[k]>7||i+dcy[k]<0||i+dcy[k]>7||f[i+dcy[k]][j+dcx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"C"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+ddx[k]<0||j+ddx[k]>7||i+ddy[k]<0||i+ddy[k]>7||f[i+ddy[k]][j+ddx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"D"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dex[k]<0||j+dex[k]>7||i+dey[k]<0||i+dey[k]>7||f[i+dey[k]][j+dex[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"E"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dfx[k]<0||j+dfx[k]>7||i+dfy[k]<0||i+dfy[k]>7||f[i+dfy[k]][j+dfx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"F"<<endl;
							break;
						}
					}
					for(int k = 0; k < 3; ++k)
					{
						if(j+dgx[k]<0||j+dgx[k]>7||i+dgy[k]<0||i+dgy[k]>7||f[i+dgy[k]][j+dgx[k]]=='0') break;
						if(k==2)
						{
							flag=true;
							cout<<"G"<<endl;
							break;
						}
					}
				}
			}
			if(flag) break;
		}
	}
  return 0;
}