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)
		fmt.Scanln()
	}
}

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

int main(){

  char str[11][11];

  while( scanf("%s",str[0]) != EOF){
    
    int x=-1,y=-1;

    for(int j=0;j<8;j++){
      if(str[0][j]=='1'){
	x=j;
	y=0;
	break;
      }
    }
    
    for(int i=1;i<8;i++){
      scanf("%s",str[i]);
      if(x==-1 && y==-1){
	for(int j=0;j<8;j++){
	  if(str[i][j]=='1'){
	    x=j;
	    y=i;
	    break;
	  }
	}
      }
    }
    
    if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x+1]=='1') printf("A\n");
    else if(str[y+1][x]=='1' && str[y+2][x]=='1' && str[y+3][x]=='1') printf("B\n");
    else if(str[y][x+1]=='1' && str[y][x+2]=='1' && str[y][x+3]=='1') printf("C\n");
    else if(str[y+1][x]=='1' && str[y+1][x-1]=='1' && str[y+2][x-1]=='1') printf("D\n");
    else if(str[y][x+1]=='1' && str[y+1][x+1]=='1' && str[y+1][x+2]=='1') printf("E\n");
    else if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x-1]=='1') printf("F\n");
    else printf("G\n");
    
  }
  return 0;
    
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int sur[8][8];
  int x, y;
  string s;

  while (true) {
    bool isGetted = false;
    for (int i = 0; i < 8; i++) {
      getline(cin, s);
      for (int j = 0; j < 8; j++) {
        if (s[j] == '1' && !isGetted) {
          x = j;
          y = i;
          isGetted = true;
        }
        sur[i][j] = s[j] - '0';
      }
    }

    if (x+1 < 8 && y+1 < 8 &&
        sur[y][x+1] && sur[y+1][x] && sur[y+1][x+1])
      cout << "A" << endl;
    else if (y+3 < 8 &&
             sur[y+1][x] && sur[y+2][x] && sur[y+3][x])
      cout << "B" << endl;
    else if (x+3 < 8 &&
             sur[y][x+1] && sur[y][x+2] && sur[y][x+3])
      cout << "C" << endl;
    else if (x-1 >= 0 && y+2 < 8 &&
             sur[y+1][x] && sur[y+1][x-1] && sur[y+2][x-1])
      cout << "D" << endl;
    else if (x+2 < 8 && y+1 < 8 &&
             sur[y][x+1] && sur[y+1][x+1] && sur[y+1][x+2])
      cout << "E" << endl;
    else if (x+1 < 8 && y+2 < 8 &&
             sur[y+1][x] && sur[y+1][x+1] && sur[y+2][x+1])
      cout << "F" << endl;
    else
      cout << "G" << endl;

    if (!getline(cin, s))
      break;
  }
  return 0;
}