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 <iostream>
#include <string>
using namespace std;
int main(){
	while(1){
		int b[8][8]={0};
		string str;
		for(int i=0;i<8;i++){
			cin>>str;
			for(int j=0;j<8;j++){
				b[i][j]=str[j]-48;
			}
		}
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(b[i][j] && b[i+1][j] && b[i][j+1] && b[i+1][j+1]){
					cout<<"A"<<endl;
					goto label;
				}else if(b[i][j] && b[i+1][j] && b[i+2][j] && b[i+3][j]){ 
					cout<<"B"<<endl;
					goto label;
				}else if(b[i][j] && b[i][j+1] && b[i][j+2] && b[i][j+3]){
					cout<<"C"<<endl;
					goto label;
				}else if(b[i][j] && b[i+1][j] && b[i+1][j-1] && b[i+2][j-1]){
					cout<<"D"<<endl;
					goto label;
				}else if(b[i][j] && b[i][j+1] && b[i+1][j+1] && b[i+1][j+2]){
					cout<<"E"<<endl;
					goto label;
				}else if(b[i][j] && b[i+1][j] && b[i+1][j+1] && b[i+2][j+1]){
					cout<<"F"<<endl;
					goto label;
				}else if(b[i][j] && b[i][j+1] && b[i+1][j] && b[i+1][j-1]){ 
					cout<<"G"<<endl;
					goto label;
				}
			}
		}
		label:;
	}
	return 0;
}

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

class Point{
public:
  int x, y;
  Point(int x = 0, int y = 0) : x(x), y(y) {}
};

int main() {
  static Point blocks[7][4];
  blocks[0][0] = Point(0, 0);
  blocks[0][1] = Point(1, 0);
  blocks[0][2] = Point(0, 1);
  blocks[0][3] = Point(1, 1);
  blocks[1][0] = Point(0, 0);
  blocks[1][1] = Point(0, 1);
  blocks[1][2] = Point(0, 2);
  blocks[1][3] = Point(0, 3);
  blocks[2][0] = Point(0, 0);
  blocks[2][1] = Point(1, 0);
  blocks[2][2] = Point(2, 0);
  blocks[2][3] = Point(3, 0);
  blocks[3][0] = Point(1, 0);
  blocks[3][1] = Point(0, 1);
  blocks[3][2] = Point(1, 1);
  blocks[3][3] = Point(0, 2);
  blocks[4][0] = Point(0, 0);
  blocks[4][1] = Point(1, 0);
  blocks[4][2] = Point(1, 1);
  blocks[4][3] = Point(2, 1);
  blocks[5][0] = Point(0, 0);
  blocks[5][1] = Point(0, 1);
  blocks[5][2] = Point(1, 1);
  blocks[5][3] = Point(1, 2);
  blocks[6][0] = Point(1, 0);
  blocks[6][1] = Point(2, 0);
  blocks[6][2] = Point(0, 1);
  blocks[6][3] = Point(1, 1);

  string data[8];
  while(getline(cin, data[0])) {
    for(int i = 1; i < 8; i++) {
      getline(cin, data[i]);
    }
    getchar();
    for(int i = 0; i < 8; i++) {
      for(int j = 0; j < 8; j++) {
	if(data[i][j] == '1') {
	  for(int n = 0; n < 7; n++) {
	    bool flag = true;
	    int ox = j - blocks[n][0].x;
	    int oy = i - blocks[n][0].y;
	    for(int p = 1; p < 4; p++) {
	      int nx = ox+blocks[n][p].x;
	      int ny = oy+blocks[n][p].y;
	      if(nx < 0 || nx >= 8 || ny < 0 || ny >= 8) {
		flag = false;
		break;
	      }

	      if(data[ny][nx] != '1') {
	        flag = false;
	        break;
	      }
	    }
	    if(flag) {
	      cout << (char)((int)'A'+n) << endl;
	      break;
	    }
	  }
	  i = 8;
	  break;
        }
      }
    }
  }
  return 0;
}

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

string s[10];

int main() {
	while(1){
		int t = 0;
		int r = 0;
		for (int i = 0; i < 9; i++) {
			if (!(cin >> s[i]))return 0;
		}
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++)
			{
				if (s[i][j] == '1') {
					if (t == 0)t = 8 * i + j;
					r += 8 * i + j;
				}
			}
		}
		r -= 4 * t;
		if (r == 19)cout << 'A' << endl;
		else if (r == 48)cout << 'B' << endl;
		else if (r == 6)cout << 'C' << endl;
		else if (r == 30)cout << 'D' << endl;
		else if (r == 20)cout << 'E' << endl;
		else if (r == 34)cout << 'F' << endl;
		else if (r == 16)cout << 'G' << endl; }
}

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

char data[8][8];
int px, py;

int main(){
	while (true){
		for(int i = 0; i < 8 ; i++){
			for(int j = 0; j < 8; j++){
				if(!(std::cin >> data[i][j]))goto end;
				if(data[i][j] == '1')px = j, py = i;
			}
		}

		if (data[py][px - 1] == '1' && data[py - 1][px] == '1' && data[py - 1][px - 1] == '1')printf("A\n");
		else if (data[py - 1][px] == '1' && data[py - 2][px] == '1' && data[py - 3][px] == '1')printf("B\n");
		else if (data[py][px - 1] == '1' && data[py][px - 2] == '1' && data[py][px - 3] == '1')printf("C\n");
		else if (data[py][px - 1] == '1' && data[py + 1][px - 1] == '1' && data[py - 1][px] == '1')printf("D\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py - 1][px - 2] == '1')printf("E\n");
		else if (data[py][px - 1] == '1' && data[py - 1][px - 1] == '1' && data[py + 1][px] == '1')printf("F\n");
		else if (data[py - 1][px] == '1' && data[py - 1][px + 1] == '1' && data[py][px - 1] == '1')printf("G\n");
	}
	end:;
	return 0;
}