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

int main(){
	char ch[10][10];
	bool judged;
	
	while((scanf("%s", ch[0])) != EOF){
		for(int i = 1; i < 8; i++){
				scanf("%s", ch[i]);
		}
		
		judged = false;
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(ch[i][j] == '1'){
					//A
					if(i + 1 < 8 && ch[i + 1][j] == '1' &&
					 j + 1 < 8 && ch[i][j + 1] == '1' &&
					 ch[i + 1][j + 1] == '1'){
						printf("A\n");
						judged = true;
						break;
					}
					//B
					if(i + 3 < 8 && ch[i + 1][j] == '1' &&
					 ch[i + 2][j] == '1' && ch[i + 3][j] == '1'){
						printf("B\n");
						judged = true;
						break;
					}
					//C
					if(j + 3 < 8 && ch[i][j + 1] == '1' &&
					 ch[i][j + 2] == '1' && ch[i][j + 3] == '1'){
						printf("C\n");
						judged = true;
						break;
					}
					//D
					if(i + 2 < 8 && j - 1 >= 0 &&
					 ch[i + 1][j - 1] == '1' && ch[i + 1][j] == '1' &&
					 ch[i + 2][j - 1] == '1'){
						printf("D\n");
						judged = true;
						break;
					}
					//E
					if(i + 1 < 8 && j + 2 < 8 &&
					 ch[i][j + 1] == '1' && ch[i + 1][j + 1] == '1' &&
					 ch[i + 1][j + 2] == '1'){
						printf("E\n");
						judged = true;
						break;
					}
					//F
					if(i + 2 < 8 && j + 1 < 8 &&
					 ch[i + 1][j] == '1' && ch[i + 1][j + 1] == '1' &&
					 ch[i + 2][j + 1] == '1'){
						printf("F\n");
						judged = true;
						break;
					}
					//G
					if(i + 1 < 8 && j + 1 < 8 && j - 1 >= 0 &&
					 ch[i + 1][j] == '1' && ch[i][j + 1] == '1' &&
					 ch[i + 1][j - 1] == '1'){
						printf("G\n");
						judged = true;
						break;
					}
				}
			}
			
			if(judged) break;
		}
	}
	
	return 0;
}

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

int main(void){
  vector<vector<char> > inp(8,vector<char>(8));
  vector<vector<int> > buf(8,vector<int>(8));
  while(cin>>inp[0][0]){
    buf[0][0]=inp[0][0]-'0';
    for(int i = 1 ; i < 8 ; i ++){
      cin>>inp[0][i];
      buf[0][i]=inp[0][i]-'0';
    }
    for(int i = 1 ; i < 8 ; i ++)
      for(int j = 0 ; j < 8 ; j ++){
        cin>>inp[i][j];
        buf[i][j]=inp[i][j]-'0'; 
      }
//cout<<buf[0][3]<<" "<<buf[0][6]<<endl;
    
    bool find=false;
    char ans;
    for(int i = 0 ; i < 8 ; i ++){
      if(find)break;
      for(int j = 0 ; j < 8 ; j ++){
        if(buf[i][j]){
          ans='O';
          if(0<=i&&i<=MAX-1 && 0<=j&&j<=MAX-1&&buf[i+1][j]&&buf[i][j+1]&&buf[i+1][j+1])ans='A';
          else if(0<=i&&i<=MAX-3 && 0<=j&&j<=MAX&&buf[i+3][j])ans='B';
          else if(0<=i&&i<=MAX && 0<=j&&j<=MAX-3&&buf[i][j+3])ans='C';
          else if(0+1<=i&&i<=MAX-1 && 0<=j&&j<=MAX-2&&buf[i-1][j+2])ans='D';
          else if(0<=i&&i<=MAX-1 && 0<=j&&j<=MAX-2&&buf[i+1][j+2])ans='E';
          else if(0<=i&&i<=MAX-2 && 0<=j&&j<=MAX-1&&buf[i+2][j+1])ans='F';
          else if(0+1<=i&&i<=MAX-1 && 0<=j&&j<=MAX-1&&buf[i][j+1]&&buf[i+1][j-1])ans='G';
          find = true;
          break;
        } 
      }
    }
    cout<<ans<<endl;
    
  }
}

C++: #include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	char table[8][9];

	while(scanf("%s",table[0])!=EOF){
		for(int i=1;i<8;i++){
			scanf("%s",table[i]);
		}
		getchar();
		bool FLG = false;
		for(int i=0; i < 8; i++){
			for(int k=0; k<8; k++){
				if(table[i][k] == '1'){
					if(i <= 6 && k <= 6 && table[i][k+1] == '1' && table[i+1][k] == '1' && table[i+1][k+1] == '1'){
						printf("A\n");
						FLG = true;
						break;
					}else if(i <= 4 && table[i+1][k] == '1' && table[i+2][k] == '1' && table[i+3][k] == '1'){
						printf("B\n");
						FLG = true;
						break;
					}else if(k <= 4 && table[i][k+1] == '1' && table[i][k+2] == '1' && table[i][k+3] == '1'){
						printf("C\n");
						FLG = true;
						break;
					}else if(i <= 5 && k >= 1 && table[i+1][k-1] == '1' && table[i+1][k] == '1' &&
							table[i+2][k-1] == '1'){
						printf("D\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 5 && table[i][k+1] == '1' && table[i+1][k+1] == '1' &&
							table[i+1][k+2] == '1'){
						printf("E\n");
						FLG = true;
						break;
					}else if(i <= 5 && k <= 6 && table[i+1][k] == '1' && table[i+1][k+1] == '1' &&
							table[i+2][k+1] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}else{
						printf("G\n");
						FLG = true;
						break;
					}
				}
			}
			if(FLG)break;
		}

	}


	return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
void func(int,int);
int main(void)
{
	char a[8][9];
	int aa[8][8],i,j,k,l,flg,ii,xx,yy;
	int px[7][3]={{1,0,1},{0,0,0},{1,2,3},{-1,0,-1},{1,1,2},{0,1,1},{1,-1,0}},
		py[7][3]={{0,1,1},{1,2,3},{0,0,0},{1,1,2},{0,1,1},{1,1,2},{0,1,1}};
	char mo[8]="ABCDEFG";
	while(scanf("%s",a[0])!=EOF)	{
		for(i=1;i<8;i++)	{
			scanf("%s",a[i]);
		}
		for(i=0;i<8;i++)	{
			for(j=0;j<8;j++)	{
				if(a[i][j]=='1')	{
					for(k=0;k<7;k++)	{
						flg=1;
						for(l=0;l<3;l++)	{
							xx=j+px[k][l];
							yy=i+py[k][l];
							if(xx<0 || xx>=8 || yy<0 || yy>=8 || a[yy][xx]!='1')	{
								flg=0;
								break;
							}
						}
						if(flg==1)	{
							ii=k;
							i=8;	j=8;	break;
						}
					}
				}
			}
		}
		printf("%c\n",mo[ii]);
					
	}
	return 0;
}