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++: //33
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(;;){
    char g[8][8];
    for(int y=0;y<8;y++){
      for(int x=0;x<8;x++){
	if(!(cin>>g[y][x]))return 0;
      }
    }
    for(int y=0;y<8;y++){
      for(int x=0;x<8;x++){
	if(g[y][x]=='1'){
	  int a=0;
	  for(int i=0;i<4;i++){
	    for(int j=0;j<4;j++){
	      a=(a<<1)+(y+i<8&&x+j<8&&g[y+i][x+j]=='1');
	    }
	  }
	  static const int f[]={0xcc00,0x8888,0xf000,0x8800,0xc600,0x8c40,0xc800};
	  cout<<char(find(f,f+7,a)-f+'A')<<endl;
	  goto next;
	}
      }
    }
  next:
    ;
  }
  return 0;
}

C++: #include <stdio.h>
int main() {
    char RB[8][9],i,j;while (scanf("%s",&RB[0])!=EOF) {for (i=1;i<8;scanf("%s",&RB[i++]));
        for (i=0;i<8;i++) for (j=0;j<8;j++) if (RB[i][j]=='1') {if (j<=4 && RB[i][j+1]=='1' && RB[i][j+2]=='1' && RB[i][j+3]=='1') puts("C"); else if (i<=4 && RB[i+1][j]=='1' && RB[i+2][j]=='1' && RB[i+3][j]=='1') puts("B"); else if (i<7 && j<7 && RB[i+1][j]=='1' && RB[i][j+1]=='1') puts("A");
        else if (i<6 && RB[i+2][j-1]=='1') puts("D"); else if (RB[i+1][j-1]=='1') puts("G"); else if (j<6 && RB[i+1][j+2]=='1') puts("E"); else puts("F"); i=10,j=10;}}return 0;}

C++: #include<iostream>
#include<cstring>
using namespace std;
int x[13][13];
int main() {
	while (true) {
		memset(x, 0, sizeof(x));
		for (int i = 1; i <= 8; i++) {
			for (int j = 1; j <= 8; j++) {
				cin >> x[i][j];
			}
		}
		for (int i = 0; i < 8; i++) {
			for (int j = 0; 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:;
	}
}

C++: #include <stdio.h>
#include <string.h>

int main(void){
	char b[65];
	char p[7][33] = {
		"1100000011",
		"10000000100000001000000010000000",
		"1111",
		"1000000110000001",
		"11000000011",
		"100000001100000001",
		"110000011",
	};
	char *bi;

	int t = 0;
	while(true){
		if(scanf("%s", b) == EOF){ break; }
		for(int i=1; i<8; ++i){
			scanf("%s", b+i*8);
		}
		bi = strchr(b, '1');
		for(int i=0; i<7; ++i){
			if(memcmp(bi, p[i], strlen(p[i])) == 0){
				printf("%c\n", 'A' + i);
				break;
			}
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <map>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	while(1){
		char field[8][9];
		int left = 8, right = 0, top = 8, bottom = 0;
		rep(y, 8){
			if(scanf("%s", field[y]) == EOF)
				return 0;
			rep(x, 8){
				if(field[y][x] == '1'){
					left = min(left, x);
					right = max(right, x);
					top = min(top, y);
					bottom = max(bottom, y);
				}
			}
		}

		int w = right - left + 1, h = bottom - top + 1;
		if(h==4)
			puts("B");
		else if(w==4)
			puts("C");
		else if(w==2 && h==2)
			puts("A");
		else if(w==2 && h==3)
			puts(field[top][left] == '1' ? "F" : "D");
		else
			puts(field[top][left] == '1' ? "E" : "G");
	}
}

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

int main() {
	char in[8][8];
	int i, j, ans = 0, lop = 0;
	while (cin >> in[lop]) {
		if (++lop < 8)
			continue;
		lop = 0;
		ans = 0;
		for (i = 0; i < 8; i++) {
			for (j = 0; j < 8; j++) {
				if (in[i][j] == '1')
					goto end;
			}
		}
	end:
		if (in[i + 3][j] == '1') {
			ans = 1;
			goto out;
		}
		if (in[i][j+3] == '1') {
			ans = 2;
			goto out;
		}
		if (in[i + 2][j - 1] == '1') {
			ans = 3;
			goto out;
		}
		if (in[i + 1][j + 2] == '1') {
			ans = 4;
			goto out;
		}
		if (in[i + 2][j + 1] == '1') {
			ans = 5;
			goto out;
		}
		if (in[i + 1][j - 1] == '1') {
			ans = 6;
			goto out;
		}
	out:
		cout << (char)('A' + ans) << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	char MAP[8][8];
	int cont = 0;
	int air_cont = 0;
	bool canCont = false;
	
	for(int i = 0; i < 8; i++){
		for(int j = 0; j < 8; j++){
			cin >> MAP[i][j];
		}
	}
	//ツ債カツ端ツづーツ個ゥツづつつッツづつゥツづァツ催古」ツづ個ブツδ債ッツクツつェツ個ゥツづつつゥツづゥツづ慊づづ個凝ウツ板陳青板づーツ記ツ録
	for(int i = 0; i < 8; i++){
		for(int j = 0; j < 8; j++){
			if(MAP[i][j] == '1'){
				cont++;
				if(cont == 1){
					canCont = true;
				}
				if(cont == 4){
					//ツδ仰ーツプツ仰ュツ青ァツ終ツ猟ケ
					goto FIN;
				}
			}
			else if(canCont == true && MAP[i][j] == '0'){
				air_cont++;
			}
		}
	}
	
	FIN:;
	
	switch(air_cont){
		case 0:
			cout << "C" << endl;
			break;
		case 5:
			cout << "G" << endl;
			break;
		case 6:
			cout << "A" << endl;
			break;
		case 7:
			cout << "E" << endl;
			break;
		case 12:
			cout << "D" << endl;
			break;
		case 14:
			cout << "F" << endl;
			break;
		case 21:
			cout << "B" << endl;
			break;
		default:
			cout << "NA" << endl;
	}
}