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 <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>

using namespace std;
typedef pair<double,double> P;




int main(){
	int field[8][8];
	string field1[9];
	int count = 0;
	while(getline(cin, field1[0])){
		if(count == 0){
			for(int i = 1;i < 8;i++){
				getline(cin, field1[i]);
			}
		}
		if(count != 0){
			for(int i = 1;i < 9;i++){
				getline(cin, field1[i]);
			}
		}

		for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				if(field1[i][j] == '1') field[i][j] = 1;
				else field[i][j] = 0;
			}
		}
		/*for(int i = 0;i < 8;i++){
			for(int j = 0;j < 8;j++){
				cout << field[i][j];
			}
			cout << endl;
		}
		cout << endl;*/
		for(int i = 0;i < 8;i++){
			int flag = 0;
			for(int j = 0;j < 8;j++){
				if(field[i][j] == 1){
					//cout << i << j <<endl;
					if(field[i][j] == field[i][j+1]){
						if(field[i][j] == field[i+1][j]){
							if(field[i][j] == field[i+1][j+1]){
								cout << "A" << endl;
								flag = 1;break;
							}
							else if(field[i][j] == field[i+1][j-1]){
								cout << "G" << endl;
								flag = 1;break;
							}
						}
						else if(field[i][j] == field[i][j+2] && field[i][j] == field[i][j+3]){
							cout << "C" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+1][j+2]){
							cout << "E" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j]){
						if(field[i][j] == field[i+1][j-1] && field[i][j] == field[i+2][j-1]){
							cout << "D" << endl;
							flag = 1;break;
						}
						else if(field[i][j] == field[i+1][j+1] && field[i][j] == field[i+2][j+1]){
							cout << "F" << endl;
							flag = 1;break;
						}
					}
					else if(field[i][j] == field[i+1][j] && field[i][j] == field[i+2][j] && field[i][j] == field[i+3][j]){
						cout << "B" << endl;
						flag = 1;break;
					}
				}
			}
			if(flag == 1) break;
		}
		count++;
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>


using namespace std;

char judge(vector<string> a){
  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      if(a.at(i)[j] == '1'){
	// not succession
	if(a[i].at(j+1) != '1'){
	  if(a[i+1].at(j-1) == '1'){
	    return 'D';
	  }else if(a[i+1].at(j+1) == '1'){
	    return 'F';
	  }else{
	    return 'B';
	  }
	}else{
	  // in succession
	  if(a[i].at(j+2) == '1'){
	    return 'C';
	  }else if(a[i+1].at(j+2) == '1'){
	    return 'E';
	  }else if(a[i+1].at(j-1) == '1'){
	    return 'G';
	  }else{
	    return 'A';
	  }
	}
      }
    }
  }
  return 'N';
}

int main(){

  while(true){
    vector<string> a;
    for(int j=0;j<8;j++){
      string s;
      cin >> s;
      a.push_back(s);
    }
    cout << judge(a) << endl;
  }
  

}

C++: #include <iostream>

#define limit(A,X,C) ((X<A)?A:(C<X)?C:X)

char map[8+1][8]={0};

int pget(int x,int y)
{
	if(limit(0,x,7)==x && limit(0,y,7)==y)
		return map[y][x]-'0';
	return 0;
}

char check(int x, int y)
{
	if(pget(x+1,y))
	{
		if(pget(x+2,y))
			return 'C';
		if(!pget(x,y+1))
			return 'E';
		if(pget(x+1,y+1))
			return 'A';
		return 'G';
	}
	if(pget(x,y+2))
		return 'B';
	if(pget(x+1,y+2))
		return 'F';
	return 'D';
}

int main(void)
{
	do
	{
		for(int i=0; i<8; i++)
			std::cin >> map[i];
		int x,y;
		for(int j=0; j<8; j++)
		{
			for(int i=0; i<8; i++)
				if(map[j][i] == '1')
				{
					x=i;
					y=j;
					break;
				}
			if(x && y)
				break;
		}

		std::cout << check(x,y) << std::endl;
	}while(std::cin >> map[0][0]);
	
	return 0;
}

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

int main()
{
  while (true)
  {
    char board[8][8];
    for (int i=0; i<8; i++)
    {
      for (int j=0; j<8; j++)
      {
        cin >> board[i][j];
      }
    }

    bool flag = false;
    for (int i=0; i<8; i++)
    {
      for (int j=0; j<8; j++)
      {
        if ( board[i][j] == '1' )   //  ブロックがあれば
        {
          if ( board[i+3][j] == '1' )
          {
            cout << 'B' << endl;
          }
          else if ( board[i][j+3] == '1' )
          {
            cout << 'C' << endl;
          }
          else if ( board[i+2][j-1] == '1' )
          {
            cout << 'D' << endl;
          }
          else if ( board[i+1][j+2] == '1' )
          {
            cout << 'E' << endl;
          }
          else if ( board[i+2][j+1] == '1' )
          {
            cout << 'F' << endl;
          }
          else if ( board[i+1][j-1] == '1' )
          {
            cout << 'G' << endl;
          }
          else
          {
            cout << 'A' << endl;
          }
          flag = true;
        }
        if (flag) break;
      }
      if (flag) break;
    }

    char dummy;
    cin >> noskipws;
    cin >> dummy;
    cin >> skipws;
    if ( cin.eof() ) break;
  }
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int x[13][13];
int main() {
	while (cin >> x[1][1]) {
		memset(x, 0, sizeof(x));
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				if (i + j > 2) { cin >> x[i][j]; }
			}
		}
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				if (x[i][j] == 1) {
					if (x[i + 1][j] == 1 && x[i][j + 1] == 1 && x[i + 1][j + 1] == 1) {
						cout << 'A' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 2][j] == 1 && x[i + 3][j] == 1) {
						cout << 'B' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i][j + 2] == 1 && x[i][j + 3] == 1) {
						cout << 'C' << endl; goto Exit;
					}
					if (x[i + 1][j - 1] == 1 && x[i + 1][j] == 1 && x[i + 2][j - 1] == 1) {
						cout << 'D' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j + 1] == 1 && x[i + 1][j + 2] == 1) {
						cout << 'E' << endl; goto Exit;
					}
					if (x[i + 1][j] == 1 && x[i + 1][j + 1] == 1 && x[i + 2][j + 1] == 1) {
						cout << 'F' << endl; goto Exit;
					}
					if (x[i][j + 1] == 1 && x[i + 1][j - 1] == 1 && x[i + 1][j] == 1) {
						cout << 'G' << endl; goto Exit;
					}
				}
			}
		}
	Exit:;
	}
}