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;

int main(){
    
    string str[10];
    
    while(cin >> str[0]){
        
        for(int i=1;i<8;i++){
            cin >> str[i];
        }
        
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                
                if(i < 7 && j < 7){
                    if(str[i][j] == '1' && str[i][j+1] == '1' && str[i+1][j] == '1' && str[i+1][j+1] == '1'){
                        cout << 'A' << endl;
                    }
                }
                
                if(i < 5){
                    if(str[i][j] == '1' && str[i+1][j] == '1' && str[i+2][j] == '1'&& str[i+3][j] == '1'){
                        cout << 'B' << endl;
                    }
                }
                
                if(j == 0 && str[i].find("1111") != string::npos){
                    cout << 'C' << endl;
                }
                
                if(i < 6 && 0 < j){
                    if(str[i][j] == '1' && str[i+1][j-1] == '1' && str[i+1][j] == '1'&& str[i+2][j-1] == '1'){
                        cout << 'D' << endl;
                    }
                }
                
                if(i < 7 && j < 6){
                    if(str[i][j] == '1' && str[i][j+1] == '1' && str[i+1][j+1] == '1'&& str[i+1][j+2] == '1'){
                        cout << 'E' << endl;
                    }
                }
                
                if(i < 6 && j < 7){
                    if(str[i][j] == '1' && str[i+1][j] == '1' && str[i+1][j+1] == '1'&& str[i+2][j+1] == '1'){
                        cout << 'F' << endl;
                    }
                }
                
                if(i < 7 && 0 < j && j < 7){
                    if(str[i][j] == '1' && str[i][j+1] == '1' && str[i+1][j-1] == '1'&& str[i+1][j] == '1'){
                        cout << 'G' << endl;
                    }
                }
                
            }
        }
        
        
    }
    
    return(0);
}

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

int main(void) {
  string board[8];
  bool check;
  
  while(cin >> board[0]) {
    check = false;
    for(int i = 1; i < 8; ++i) {
      cin >> board[i];
    }
    for(int i = 0; i < 8; ++i) {
      for(int j = 0; j < 8; ++j) {
        if(board[i][j] == '1' && !check) {
          if(i <= 4 && board[i + 3][j] == '1') {
            cout << "B" << endl;
            check = true;
          } else if(j <= 4 &&  board[i][j + 3] == '1') {
            cout << "C" << endl;
            check = true;
          } else if(i <= 5 && j >= 1 && board[i + 2][j - 1] == '1') {
            cout << "D" << endl;
            check = true;
          } else if(i <= 6 && j <= 5 && board[i + 1][j + 2] == '1') {
            cout << "E" << endl;
            check = true;
          } else if(i <= 5 && j <= 6 && board[i + 2][j + 1] == '1') {
            cout << "F" << endl;
            check = true;
          } else if(i <= 6 && 1 <= j && j <= 6 &&board[i + 1][j - 1] == '1') {
            cout << "G" << endl;
            check = true;
          } else if(i <= 6 && j <= 6){
            cout << "A" << endl;
            check = true;
          }
        }
      }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string mass[8];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i-1][j] == '1' && mass[i-1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    bool f;
    
    while (cin >> mass[0] >> mass[1] >> mass[2] >> mass[3] >> mass[4] >> mass[5] >> mass[6] >> mass[7]) {
        f = false;
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}