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 <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        vector<string> s(8);
        for(int i=0; i<8; ++i){
            if(!(cin >> s[i]))
                return 0;
        }

        int dy[] = {3, 0, 2, 1, 2, 1};
        int dx[] = {0, 3, -1, 2, 1, -1};

        bool ok = false;
        for(int i=0; i<8; ++i){
            for(int j=0; j<8; ++j){
                if(ok || s[i][j] == '0')
                    continue;
                for(int k=0; k<6; ++k){
                    if(i+dy[k] < 8 && 0 <= j+dx[k] && j+dx[k] < 8 && s[i+dy[k]][j+dx[k]] == '1'){
                        cout << (char)('B' + k) << endl;
                        ok = true;
                        break;
                    }
                }
                if(!ok){
                    cout << 'A' << endl;
                    ok = true;
                }
            }
        }
    }
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

string str[8];

bool F(int x,int y){
	return (0<=x&&x<8&&0<=y&&y<8&&str[y][x]=='1')?true:false;
}

int main() {
	while(cin>>str[0]>>str[1]>>str[2]>>str[3]>>str[4]>>str[5]>>str[6]>>str[7]){
		int x,y;
		for(y=0;y<8;y++){
			for(x=0;x<8;x++){
				if(F(x,y)){
					if(F(x+1,y)){
						if(F(x+2,y)){
							puts("C");
						}else{
							if(F(x,y+1)){
								if(F(x+1,y+1)){
									puts("A");
								}else{
									puts("G");
								}
							}else{
								puts("E");
							}
						}
					}else{
						if(F(x,y+2)){
							puts("B");
						}else if(F(x-1,y+2)){
							puts("D");
						}else{
							puts("F");
						}
					}
					goto next;
				}
			}
		}
		next:;
	}
	return 0;
}

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

#define MAX_LINE 8
#define MAXA_DATA 50

using namespace std;

// プロトタイプ宣言
void searchString(string box);

int main() {
    int i, count = 0;
    int max = MAX_LINE * MAXA_DATA;
    char str[8];
    string box;
    for (i=0; i<max; i++) {
        cin >> str;
        box.append(str);
        //cout << str << endl;
        count++;
        if(count%8 == 0){
            //cout << box << endl << endl;
            // 文字列チェック
            searchString(box);
            box = "";
        }
        if((string)str == "finish"){
            break;
        }
    }
}

void searchString(string box){
    string A("1100000011");
    string B("1000000010000000100000001");
    string C("1111");
    string D("1000000110000001");
    string E("11000000011");
    string F("100000001100000001");
    string G("110000011");
    if (box.find(A) != std::string::npos) {
        cout << "A" << endl;
    }
    else if(box.find(B) != std::string::npos) {
        cout << "B" << endl;
    }
    else if(box.find(C) != std::string::npos) {
        cout << "C" << endl;
    }
    else if(box.find(D) != std::string::npos) {
        cout << "D" << endl;
    }
    else if(box.find(E) != std::string::npos) {
        cout << "E" << endl;
    }
    else if(box.find(F) != std::string::npos) {
        cout << "F" << endl;
    }
    else if(box.find(G) != std::string::npos) {
        cout << "G" << endl;
    }
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<string>
using namespace std;
char m[10][10];
int main(void){
  for(int i=1;i<=8;i++){
    for(int j=1;j<=8;j++){
      scanf(" %c",&m[i][j]);
    }
  }
  bool f=true;
  for(int i=1;i<=8 && f;i++){
    for(int j=1;j<=8 && f;j++){
      if(m[i][j]=='1'){
	if(m[i+1][j]=='1' && m[i][j+1]=='1' && m[i+1][j+1]=='1'){
	  puts("A");
	  f=false;
	}
	else if(m[i+1][j]=='1' && m[i+2][j]=='1' && m[i+3][j]=='1'){
	  puts("B");
	  f=false;
	}
	else if(m[i][j+1]=='1' && m[i][j+2]=='1' && m[i][j+3]=='1'){
	  puts("C");
	  f=false;
	}
	else if(m[i+1][j]=='1' && m[i+1][j-1]=='1' && m[i+2][j-1]=='1'){
	  puts("D");
	  f=false;
	}
	else if(m[i][j+1]=='1' && m[i+1][j+1]=='1' && m[i+1][j+2]=='1'){
	  puts("E");
	  f=false;
	}
	else if(m[i+1][j]=='1' && m[i+1][j+1]=='1' && m[i+2][j+1]=='1'){
	  puts("F");
	  f=false;
	}
	else if(m[i][j+1]=='1' && m[i+1][j]=='1' && m[i+1][j-1]=='1'){
	  puts("G");
	  f=false;
	}
      }
    }
  }
}