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 <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;
}

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

int main(void){
  vector<vector<char> > inp(MAX,vector<char>(MAX));
  vector<vector<int> > buf(MAX,vector<int>(MAX));
  while(cin>>inp[0][0]){
    buf[0][0]=inp[0][0]-'0';
    for(int i = 1 ; i < MAX ; i ++){
      cin>>inp[0][i];
      buf[0][i]=inp[0][i]-'0';
    }
    for(int i = 1 ; i < MAX ; i ++)
      for(int j = 0 ; j < MAX ; 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 < MAX ; i ++){
      if(find)break;
      for(int j = 0 ; j < MAX ; 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 <iostream>
using namespace std;

char ch[8][8]={};
bool check(int x, int y){
  return (0<=x && x<8 && 0<=y && y<8)&&(ch[x][y]=='1');
}

int main() {
  while(cin >> ch[0][0]) {
    for(int i=1; i<8; i++) cin >> ch[0][i];
    for(int i=1; i<8; i++) {
      for(int j=0; j<8; j++) cin >> ch[i][j];
    }
    int x,y;
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(ch[i][j]=='1') {
	  x=i;
	  y=j;
	}
      }
    }
    if(check(x-3,y)) cout << "B" << endl;
    else if(check(x,y-3)) cout << "C" << endl;
    else if(check(x-2,y+1)) cout << "D" << endl;
    else if(check(x-1,y-2)) cout << "E" << endl;
    else if(check(x-2,y-1)) cout << "F" << endl;
    else if(check(x,y-1) && check(x-1,y+1)) cout << "G" << endl;
    else cout << "A" << endl;
  }
  return 0;
}