Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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;
bool check(int (&field)[8][8],int x,int y){
	if(x<0 || x>=8 || y<0 || y>=8 || (field[y][x] == 0)){
		return false;
	}
	return true;
}

int main(){
	int inptf[8][8] = {0}, i, j, x, y;
	string str;
	char btype;
	while(true){
		i=0;
		while(cin>>str){
			for(j=0;j<8;j++){
				inptf[i][j] = str[j] - '0';
			}
			i++;
			if(i==8) break;
		}
		if(i<8) break;
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				if(inptf[i][j] != 0){
					y = i;
					x = j;
					i=j=8;
				}
			}
		}
		if(check(inptf , x, y) &&	//[][] A
		   check(inptf , x, y+1) &&	//[][]
		   check(inptf , x+1, y) &&	
		   check(inptf , x+1, y+1))	
			btype='A';
			
		if(check(inptf , x, y) &&	//[] B
		   check(inptf , x, y+1) &&	//[]
		   check(inptf , x, y+2) &&	//[]
		   check(inptf , x, y+3))	//[]
			btype='B';
		if(check(inptf , x, y) &&	//[][][][] C
		   check(inptf , x+1, y) &&	
		   check(inptf , x+2, y) &&	
		   check(inptf , x+3, y))	
			btype='C';
		if(check(inptf , x, y) &&	//  [] D
		   check(inptf , x, y+1) &&	//[][]
		   check(inptf , x-1, y+1) &&	//[]
		   check(inptf , x-1, y+2) )	
			btype='D';
		if(check(inptf , x, y) &&	//[][] E
		   check(inptf , x+1, y) &&	//  [][]
		   check(inptf , x+1, y+1) &&	
		   check(inptf , x+2, y+1))	
			btype='E';
		if(check(inptf , x, y) &&	//[]   F
		   check(inptf , x, y+1) &&	//[][]
		   check(inptf , x+1, y+1) &&	//  []
		   check(inptf , x+1, y+2))	
			btype='F';
		if(check(inptf , x, y) &&	//  [][]G
		   check(inptf , x+1, y) &&	//[][]
		   check(inptf , x, y+1) &&
		   check(inptf , x-1, y+1))	
			btype='F';
		cout<<btype<<endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int ax, ay;
	char f[12][12];
	bool flag = false;

	for(int y=0 ; y<12 ; y++){
		for(int x=0 ; x<12 ; x++){
			f[y][x] = 0;
		}
	}

	while( 1 ){
		for(int i=0 ; i<8 ; i++) {
			if( scanf("%s", f[i]) == EOF ){
				flag = true;
				break;
			}
		}
		if(flag) break;

		for(int i=0 ; i<64 ; i++){
			if(f[i/8][i%8]=='1'){
				ax = i%8;
				ay = i/8;
				//printf("x:%d y:%d\n", ax,ay);
				break;
			}
		}
		//printf("hoge\n");
		if( f[ay+1][ax]=='1' && f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' ){
			printf("A\n");
		}else if( f[ay+1][ax]=='1' && f[ay+2][ax]=='1' && f[ay+3][ax]=='1' ){
			printf("B\n");
		}else if( f[ay][ax+1]=='1' && f[ay][ax+2]=='1' && f[ay][ax+3]=='1' ){
			printf("C\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax+1]=='1' && f[ay+1][ax+2]=='1' ){
			printf("E\n");
		}else if( f[ay+1][ax]=='1' && f[ay+1][ax+1]=='1' && f[ay+2][ax+1]=='1' ){
			printf("F\n");
		}else if( f[ay][ax+1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("G\n");
		}else if( f[ay+2][ax-1]=='1' && f[ay+1][ax]=='1' && f[ay+1][ax-1]=='1' ){
			printf("D\n");
		}
	}
	

	return 0;
}

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

int main(){

  char str[11][11];

  while( scanf("%s",str[0]) != EOF){
    
    int x=-1,y=-1;

    for(int j=0;j<8;j++){
      if(str[0][j]=='1'){
	x=j;
	y=0;
	break;
      }
    }
    
    for(int i=1;i<8;i++){
      scanf("%s",str[i]);
      if(x==-1 && y==-1){
	for(int j=0;j<8;j++){
	  if(str[i][j]=='1'){
	    x=j;
	    y=i;
	    break;
	  }
	}
      }
    }
    
    if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x+1]=='1') printf("A\n");
    else if(str[y+1][x]=='1' && str[y+2][x]=='1' && str[y+3][x]=='1') printf("B\n");
    else if(str[y][x+1]=='1' && str[y][x+2]=='1' && str[y][x+3]=='1') printf("C\n");
    else if(str[y+1][x]=='1' && str[y+1][x-1]=='1' && str[y+2][x-1]=='1') printf("D\n");
    else if(str[y][x+1]=='1' && str[y+1][x+1]=='1' && str[y+1][x+2]=='1') printf("E\n");
    else if(str[y][x+1]=='1' && str[y+1][x]=='1' && str[y+1][x-1]=='1') printf("F\n");
    else printf("G\n");
    
  }
  return 0;
    
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	int i, j, ctr1 = 0, ctr2 = 0;
	string s, ans;
	vector<string> ANS;
	bool B[8][8];

	while (1) {
		while (cin >> s) {
			for (i = 0; i < 8; i++) {
				B[ctr1][i] = stoi(s.substr(i, 1));
			}
			ctr1++; ctr2++;  if (ctr1 == 8)break;
		}

		for (i = 0; i < 7; i++) {//A
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j] == 1 && B[i + 1][j + 1] == 1)ans = 'A';
			}
		}

		for (i = 0; i < 5; i++) {//B
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i + 1][j] == 1 && B[i + 2][j] == 1 && B[i + 3][j] == 1)ans = 'B';
			}
		}

		for (i = 0; i < 7; i++) {//C
			for (j = 0; j < 5; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i][j + 2] == 1 && B[i][j + 3] == 1)ans = 'C';
			}
		}

		for (i = 0; i < 6; i++) {//D
			for (j = 1; j < 8; j++) {
				if (B[i][j] == 1 && B[i + 1][j - 1] == 1 && B[i + 1][j] == 1 && B[i + 2][j - 1] == 1)ans = 'D';
			}
		}

		for (i = 0; i < 7; i++) {//E
			for (j = 0; j < 6; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j + 1] == 1 && B[i + 1][j + 2] == 1)ans = 'E';
			}
		}

		for (i = 0; i < 6; i++) {//F
			for (j = 0; j < 7; j++) {
				if (B[i][j] == 1 && B[i + 1][j] == 1 && B[i + 1][j + 1] == 1 && B[i + 2][j + 1] == 1)ans = 'F';
			}
		}

		for (i = 0; i < 7; i++) {//G
			for (j = 1; j < 7; j++) {
				if (B[i][j] == 1 && B[i][j + 1] == 1 && B[i + 1][j - 1] == 1 && B[i + 1][j] == 1)ans = 'G';
			}
		}
		if (ctr2 == 0)break; ctr1 = 0;
		ANS.push_back(ans); ctr2 = 0;
	}
	for (i = 0; i < ANS.size(); i++)cout << ANS[i] << endl;
	return 0;
}