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>
#include <string>

using namespace std;

int main(void)
{
    char data[12][12];

    while (cin >> data[0]) {
        for (int i = 1; i < 8; i++) {
            cin >> data[i];
        }
        getchar();

        bool fl = false;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (data[i][j] == '1') {
                    if (data[i][j+1] == '1' &&
                            data[i+1][j+1] == '1' &&
                            data[i+1][j] == '1') {
                        puts("A");
                        fl = true;
                    } else if (data[i+1][j] == '1' &&
                            data[i+2][j] == '1' &&
                            data[i+3][j] == '1' ) {
                        puts("B");
                        fl = true;
                    } else if (data[i][j+1] == '1' && 
                            data[i][j+2] == '1' &&
                            data[i][j+3] == '1') {
                        puts("C");
                        fl = true;
                    } else if (data[i+1][j] == '1' && 
                            data[i+1][j-1] == '1' &&
                            data[i+2][j-1] == '1') {
                        puts("D");
                        fl = true;
                    } else if (data[i][j+1] == '1' && 
                            data[i+1][j+1] == '1' &&
                            data[i+1][j+2] == '1') {
                        puts("E");
                        fl = true;
                    } else if (data[i+1][j] == '1' && 
                            data[i+1][j+1] == '1' &&
                            data[i+2][j+1] == '1') {
                        puts("F");
                        fl = true;
                    } else if (data[i+1][j] == '1' && 
                            data[i][j+1] == '1' &&
                            data[i+1][j-1] == '1') {
                        puts("G");
                        fl = true;
                    }
                }
                if (fl) {
                    break;
                }
            }
            if (fl) {
                break;
            }
        }
    }

    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int dx[7][3] = {{0,1,1},{0,0,0},{1,2,3},{-1,-1,0},{1,1,2},{0,1,1},{-1,0,1} };
  int dy[7][3] = {{1,0,1},{1,2,3},{0,0,0},{1,2,1},{0,1,1},{1,1,2},{1,1,0} };

  char ba[8][8];
  while(cin>>ba[0][0]) {
    REP(i,8)
      REP(j,8)
        if (i!=0||j!=0)
          cin >> ba[j][i];
    int f = -1;
    REP(y,8) {
      REP(x,8) {
        if (ba[x][y] == '1') {
          REP(i,7) {
            int j = 0;
            for(;j<3;j++) {
              int xx = x + dx[i][j];
              int yy = y + dy[i][j];
              if (xx<0||8<=xx||yy<0||8<=yy) break;
              if (ba[xx][yy] != '1')
                break;
            }
            if (j==3) {
              f = i;
              break;
            }
          }
          if (f>=0) break;
        }
        if (f>=0) break;
      }
      if (f>=0) break;
    }
    cout << (char)('A' + f) << endl;
  }
}

C++: #include <iostream>
using namespace std;
char box[8][8];
char search(const int i,const int j){
	if(box[i][j+1]=='1' && box[i+1][j]=='1' && box[i+1][j+1]=='1') return('A'); 
	else if(box[i+1][j]=='1' && box[i+2][j]=='1' && box[i+3][j]=='1') return('B') ;
	else if(box[i][j+1]=='1' && box[i][j+2]=='1' && box[i][j+3]=='1') return('C') ;
	else if(box[i+1][j]=='1' && box[i+1][j-1]=='1' && box[i+2][j-1]=='1') return('D');
	else if(box[i][j+1]=='1' && box[i+1][j+1]=='1' && box[i+1][j+2]=='1') return('E');
	else if(box[i+1][j]=='1' && box[i+1][j+1]=='1' && box[i+2][j+1]=='1') return('F');
	else if(box[i][j+1]=='1' && box[i+1][j]=='1' && box[i+1][j-1]=='1') return('G'); 
	else return('0');
}

int main(){
	while(cin>>box[0][0]){
		for(int i=1;i<8;i++) cin >> box[0][i] ;
	char ans='0';bool flag=false;
	for(int i=1;i<8;i++)
		for(int j=0;j<8;j++) cin >> box[i][j] ;
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(box[i][j]=='0') continue;
			if(ans=='0' && box[i][j]=='1') ans=search(i,j);
		};
	};
	cout << ans << '\n' ;
	};
}