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 <iostream>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
 
int xb[7][3] = {
        {1, 0, 1},
        {0, 0, 0},
        {1, 2, 3},
        {0, -1, -1},
        {1, 1, 2},
        {0, 1, 1},
        {1, 0, -1}
};
 
int yb[7][3] = {
        {0, 1, 1},
        {1, 2, 3},
        {0, 0, 0},
        {1, 1, 2},
        {0, 1, 1},
        {1, 1, 2},
        {0, 1, 1}
};
 
int main() {
        string field[8];
        while(getline(cin, field[0])) {
                for(int i = 1; i < 8; i++) getline(cin, field[i]);
 
                char ans = '\0';
                rep(y,8) {
                        rep(x,8) {
                                if(field[y][x] == '1') {
                                        // cerr << "x: " << x << " " << "y: " << y << endl;
                                        rep(i,8) {
                                                bool f = true;
                                                rep(j,3) {
                                                        int nx = xb[i][j];
                                                        int ny = yb[i][j];
                                                        if(0 <= nx && nx < 8 && 0 <= ny && ny < 8) {
                                                                if(field[y+ny][x+nx] != '1') {
                                                                        f = false;
                                                                        break;
                                                                }
                                                        }       
                                                }
                                                if(f) {
                                                        ans = 'A' + i;
                                                        goto END;
                                                }
                                        }
                                }
                        }
                }
        END:
                cout << ans << endl;
                getline(cin, field[0]);
        }
        return 0;
}

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

string table[8];
bool range(int y,int x)
{
	if (y < 0 || x < 0 || y >= 8 || x >= 8)return false;
	return true;
}
bool A(int y, int x)
{
	int dx[] = {0,1,1,0};
	int dy[] = {0,0,1,1};
	for (int i = 0; i < 4; i++)
	{
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (range(ny, nx) && table[ny][nx] == '1')continue;
		return false;
	}
	return true;
}
bool B(int y, int x)
{
	int dx[] = { 0, 0, 0, 0 };
	int dy[] = { 0, 1, 2, 3 };
	for (int i = 0; i < 4; i++)
	{
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (range(ny, nx) && table[ny][nx] == '1')continue;
		return false;
	}
	return true;
}
bool C(int y, int x)
{
	int dx[] = { 0, 1, 2, 3 };
	int dy[] = { 0, 0, 0, 0 };
	for (int i = 0; i < 4; i++)
	{
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (range(ny, nx) && table[ny][nx] == '1')continue;
		return false;
	}
	return true;
}
bool D(int y, int x)
{
	int dx[] = { 0, 0, -1, -1 };
	int dy[] = { 0, 1,1, 2 };
	for (int i = 0; i < 4; i++)
	{
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (range(ny, nx) && table[ny][nx] == '1')continue;
		return false;
	}
	return true;
}
bool E(int y, int x)
{
	int dx[] = { 0, 1, 1, 2 };
	int dy[] = { 0, 0, 1, 1 };
	for (int i = 0; i < 4; i++)
	{
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (range(ny, nx) && table[ny][nx] == '1')continue;
		return false;
	}
	return true;
}
bool F(int y, int x)
{
	int dx[] = { 0, 0, 1, 1 };
	int dy[] = { 0, 1, 1, 2 };
	for (int i = 0; i < 4; i++)
	{
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (range(ny, nx) && table[ny][nx] == '1')continue;
		return false;
	}
	return true;
}
bool G(int y, int x)
{
	int dx[] = { 0, 1, 0, -1 };
	int dy[] = { 0, 0, -1, -1 };
	for (int i = 0; i < 4; i++)
	{
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (range(ny, nx) && table[ny][nx] == '1')continue;
		return false;
	}
	return true;
}
char check(int y, int x)
{
	if (A(y, x))return 'A';
	else if (B(y, x))return 'B';
	else if (C(y, x))return 'C';
	else if (D(y, x))return 'D';
	else if (E(y, x))return 'E';
	else if (F(y, x))return 'F';
	else if (G(y, x)) return 'G';
	else return 0;
}
int main()
{
	while (true)
	{
		for (int i = 0; i < 8; i++)
		{
			if (!(cin >> table[i]))return 0;
		}
		bool find = false;
		for (int i = 0; i < 8; i++)
		{
			for (int j = 0; j < 8; j++)
			{
				int ret = check(i,j);
				if (ret > 0)
				{
					find = true;
					cout << ((char)ret) << endl;
					break;
				}
			}
			if (find)break;
		}
	}
	return 0;
}

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

string M[8];

bool inF(int y, int x) {
  return 0<=x && x<8 && 0<=y && y<8;
}

int main() {

  while(cin>>M[0]) {
    for(int i=1; i<8; i++) cin >> M[i];
    
    char res = '#';
    
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(M[i][j]-'0') {
	  
	  if(inF(i+1, j+1) && M[i+1][j+1]-'0') {
	    if(inF(i+2, j+1) && M[i+2][j+1]-'0') {
	      res = 'F'; goto end;
	    } else if(inF(i+1, j+2) && M[i+1][j+2]-'0') {
	      res = 'E'; goto end;
	    } else {
	      res = 'A'; goto end;
	    }
	  }
	  
	  if(inF(i+3, j) && M[i+3][j]-'0') {
	    res = 'B'; goto end;
	  }

	  if(inF(i, j+3) && M[i][j+3]-'0') {
	    res = 'C'; goto end;
	  }

	  if(inF(i+1, j-1) && M[i+1][j-1]-'0') {
	    if(inF(i, j+1) && M[i][j+1]-'0') {
	      res = 'G'; goto end;
	    } else {
	      res = 'D'; goto end;
	    }
	  }
	}
      }
    }
    end:
    cout << res << endl;
  }
  return 0;
}