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>
using namespace std;

int main()
{
	while(!cin.eof())
	{
		if(cin.eof())
			break;
		long a[8] = {0};
		for(int i = 0; i < 8; i++)
		{
			long x;
			cin >> x;
			for(int j = 0; j < 8; j++)
			{
				a[i] += (x % 10) << j;
				x /= 10;
			}
		}

		/*for(int i = 0; i < 8; i++)
			cout << i << ' ' << a[i] << endl;
		*/

		char c = 'A';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'B';
		for(int i = 0; i < 5; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == (1 << j))
					if(a[i + 1] == (1 << j))
					{
						//cout << "B " << (1 << j) << endl;
						goto END;
					}

		c = 'C';
		for(int i = 0; i < 8; i++)
			for(int j = 0; j < 5; j++)
			{
				//cout << 'C' << ' ' << (15 << j) << endl;
				if(a[i] == 15 << j)
					goto END;

			}
		c = 'D';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 1 << j)
					if(a[i + 1] == 3 << j)
						goto END;

		c = 'E';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 7; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << (j-1))
						goto END;

		c = 'F';
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 8; j++)
				if(a[i] == 1 << j)
					goto END;

		c = 'G';
		for(int i = 0; i < 7; i++)
			for(int j = 0; j < 6; j++)
				if(a[i] == 3 << j)
					if(a[i + 1] == 3 << (j + 1))
						goto END;

		break;

	END:
		cout << c << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
int main(){
	std::string s[8];
	int f = 0;
	while(1){
		if(f)std::cout << "\n";
		else f = 1;
		int x = 0,y = 0;
		for(int i=0;i<8;i++){
			std::cin >> s[i];
			if(std::cin.eof())return 0;
				for(int j=0;j<8;j++)
					if(s[i][j] == '1' && !x && !y)x=j,y=i;
		}
		
		char res;
		if(s[y+1][x] == '1'){
			if(s[y+1][x-1] == '1'){
				if(s[y][x+1] == '1'){
					res = 'G';
				}
				else{
					res = 'D';
				}
			}
			else if(s[y+1][x+1] == '1'){
				if(s[y][x+1] == '1'){
					res = 'A';
				}
				else{
					res = 'F';
				}
			}
			else{
				res = 'B';
			}
		}
		else{
			if(s[y+1][x+1] == '1'){
				res = 'E';
			}
			else{
			res = 'C';
			}
		}

		std::cout << res << std::endl;
	}
}

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

int main(){
    while(1){
        vector<string> v(8);
        int sx=8,sy=8,ex=-1,ey=-1;
        for(int i=0; i<8; i++){
            if(!(cin>>v[i])) goto end;
            for(int j=0; j<8; j++){
                if(v[i][j]=='1'){
                    sx=min(sx,j);
                    sy=min(sy,i);
                    ex=max(ex,j);
                    ey=max(ey,i);
                }
            }
        }
        char ans;
        if(sx==ex) ans='B';
        else if(sy==ey) ans='C';
        else if(ex-sx==1&&ey-sy==1) ans='A';
        else if(v[ey][ex]=='0'&&sx-ex==1) ans='G';
        else if(v[ey][ey]=='0'&&sx-ey==2) ans='D';
        else if(ex-sx==2) ans='E';
        else ans='F';
        cout<<ans<<endl;
    }
 end:;
}

C++: #include<iostream>
#include<string>
#include<vector>
#define N 8

using namespace std;

int checkA(const vector<string>, int, int);
int checkB(const vector<string>, int, int);
int checkC(const vector<string>, int, int);
int checkD(const vector<string>, int, int);
int checkE(const vector<string>, int, int);
int checkF(const vector<string>, int, int);
int checkG(const vector<string>, int, int);

int main(){
  int i, j, isFound;
  string s;
  vector<string> data;

  while(cin >> s){
    data.push_back(s);

    for(i=1; i<N; ++i){
      cin >> s;
      data.push_back(s);
    }

    for(i=0, isFound=0; i<N; ++i){
      for(j=0; j<N; ++j){
        if(data[i][j] == '1'){
	  isFound = 1;
          break;
        }
      }
      if(isFound == 1) break;
    }

    if(checkA(data, i, j) == 1) cout << "A" << endl;
    else if(checkB(data, i, j) == 1) cout << "B" << endl;
    else if(checkC(data, i, j) == 1) cout << "C" << endl;
    else if(checkD(data, i, j) == 1) cout << "D" << endl;
    else if(checkE(data, i, j) == 1) cout << "E" << endl;
    else if(checkF(data, i, j) == 1) cout << "F" << endl;
    else if(checkG(data, i, j) == 1) cout << "G" << endl;

    data.clear();
  }

  return 0;
}

int checkA(const vector<string> data, int i, int j){
  int n, m;
  n = i + 1;
  m = j + 1;
  if(n < N && m < N){
    if(data[i][m] == '1' && data[n][j] == '1' && data[n][m] == '1')
      return 1;
  }
  return 0;
}

int checkB(const vector<string> data, int i, int j){
  int n;
  n = i + 3;

  if(n < N){
    if(data[i+1][j] == '1' && data[i+2][j] == '1' && data[n][j] == '1')
      return 1;
  }
  return 0;
}

int checkC(const vector<string> data, int i, int j){
  int n, m;
  n = j + 3;

  if(n < N){
    if(data[i][j+1] == '1' && data[i][j+2] == '1' && data[i][n] == '1')
      return 1;
  }
  return 0;
}

int checkD(const vector<string> data, int i, int j){
  int n, m;
  n = i + 2;
  m = j - 1;

  if(n < N && m >= 0){
    if(data[i+1][m] == '1' && data[i+1][j] == '1' && data[n][m] == '1')
      return 1;
  }
  return 0;
}

int checkE(const vector<string> data, int i, int j){
  int n, m;
  n = i + 1;
  m = j + 2;

  if(n < N && m < N){
    if(data[i][j+1] == '1' && data[n][j+1] == '1' && data[n][m] == '1')
      return 1;
  }
  return 0;
}

int checkF(const vector<string> data, int i, int j){
  int n, m;
  n = i + 2;
  m = j + 1;

  if(n < N && m < N){
    if(data[i+1][j] == '1' && data[i+1][m] == '1' && data[n][m] == '1')
      return 1;
  }
  return 0;
}

int checkG(const vector<string> data, int i, int j){
  int k, n, m;
  k = j - 1;
  n = i + 1;
  m = j + 1;

  if(k >= 0 && n < N && m < N){
    if(data[i][m] == '1' && data[n][k] == '1' && data[n][j] == '1')
      return 1;
  }
  return 0;
}