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.h>

#define MAX_LINE 8
#define MAXA_DATA 50

using namespace std;

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

// main関数
int main() {
    int count = 0;
    int max = MAX_LINE * MAXA_DATA;
    char str[8];
    string box;
    for (int i = 0; i < max; i++) {
        while(cin >> str){
            //cin >> str;
            box.append(str);
            count++;
            // 8行ごとにチェック
            if(count%MAX_LINE == 0){
                searchString(box);
                box = "";
                //cout << "flag" << endl;
            }
        }
    }
}

// 文字列チェック
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");
    
    // find関数は文字列がみつからなかったときにnposを返す
    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 <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
bool pos(int x,int y){
  return 0<=x&&x<8&&0<=y&&y<8;
}
int main(){
  string in;
  int fld[8][8];
  while(cin>>in){
    for(int i=0;i<8;i++)fld[i][0]=in[i]-'0';
    for(int i=1;i<8;i++){
      cin>>in;
      for(int j=0;j<8;j++){
        fld[j][i]=in[j]-'0';
      }
    }
    char ans='.';
    for(int x=0;x<8;x++){
      if(ans!='.')break;
      for(int y=0;y<8;y++){
        if(ans!='.')break;
        if(fld[x][y]){
          if(fld[x+1][y]&&pos(x+1,y)){
            if(fld[x][y+1]&&pos(x,y+1)){
              if(fld[x+1][y+1]&&pos(x+1,y+1))ans='A';
              else if(fld[x-1][y+1]&&pos(x-1,y+1))ans='G';
            }
            if(fld[x+2][y]&&fld[x+3][y]&&pos(x+2,y)&&pos(x+3,y))ans='C';
            if(fld[x+1][y+1]&&fld[x+2][y+1]&&pos(x+1,y+1)&&pos(x+2,y+1))ans='E';
          }else if(fld[x][y+1]&&pos(x,y+1)){
            if(fld[x][y+2]&&pos(x,y+2)&&fld[x][y+3]&&pos(x,y+3))ans='B';
            if(fld[x-1][y+1]&&pos(x-1,y+2)&&fld[x-1][y+2]&&pos(x-1,y+2))ans='D';
            if(fld[x+1][y+1]&&pos(x+1,y+1)&&fld[x+1][y+2]&&pos(x+1,y+2)) ans='F';
          }
        }
      }
    }
    cout<<ans<<endl;
  }
}

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

int main() {
  string str;
  char b[7][3][2] = {
    {{0,1},{1,0},{1,1}},
    {{1,0},{2,0},{3,0}},
    {{0,1},{0,2},{0,3}},
    {{1,-1},{1,0},{2,-1}},
    {{0,1},{1,1},{1,2}},
    {{1,0},{1,1},{2,1}},
    {{0,1},{1,-1},{1,0}},
  };
  bool a[8][8],flg;
  int r,c,nr,nc;

  while (1) {
    for (int i=0; i<8; i++) {
      cin >> str;
      for (int j=0; j<8; j++) {
        char c = str.at(j);
        a[i][j] = (c=='0') ? false : true;
      }
    }
    if (!cin) break;

    flg = false;
    for (int i=0; i<8; i++) {
      for (int j=0; j<8; j++) {
        if (a[i][j]) {
          r = i;
          c = j;
          flg = true;
          break;
        }
      }
      if (flg) break;
    }

    for (int i=0; i<7; i++) {
      int j;
      for (j=0; j<3; j++) {
        nr = r + b[i][j][0];
        nc = c + b[i][j][1];
        if (nr<0||nr>=8||nc<0||nc>=8) break;
        if (!a[nr][nc]) break;
      }
      if (j == 3) {
        cout << (char)('A'+i) << endl;
        break;
      }
    }
  }

  return 0;
}

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

bool map[8][8];

char Solve(int x,int y){

  if(x!=7 && map[y][x+1]==1 && y!=7 && map[y+1][x]==1 && map[y+1][x+1]==1)
    return 'A';

  else if(y<=4&&map[y+1][x]==1&&map[y+2][x]==1&&map[y+3][x]==1)
    return 'B';

  else if(x<=4&&map[y][x+1]==1&&map[y][x+2]==1&&map[y][x+3]==1)
    return 'C';

  else if(x>0&&y<=5&&map[y+1][x]==1&&map[y+1][x-1]==1&&map[y+2][x-1]==1)
    return 'D';

  else if(y<7&&x<=5&&map[y][x+1]==1&&map[y+1][x+1]==1&&map[y+1][x+2]==1)
    return 'E';

  else if(x<7&&y<=5&&map[y+1][x]==1&&map[y+1][x+1]==1&&map[y+2][x+1]==1)
    return 'F';

  else
    return 'G';

}

int main(){

  char c;

  while(cin>>c){

    map[0][0]=c-'0';

    for(int i=1; i<8; i++){cin>>c;map[0][i]=c-'0';}
    for(int i=1; i<8; i++)for(int j=0; j<8; j++){cin>>c;map[i][j]=c-'0';}

    int i,j;
    for(i=0; i<8; i++){
      for(j=0; j<8; j++){
        if(map[i][j]==true)goto BREAK;
      }
    }
    BREAK:;

  //  for(int m=0;m<8;m++){for(int n=0;n<8;n++)cout<<map[m][n];cout<<endl;}

    cout << Solve(j,i) << endl;

  //  getchar();

  }


  return 0;

}