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<stdio.h>

int main(){
char a[8][8];
int ans = 0;
while(1){
for(int i = 0; i < 8; i++){
if(scanf("%s",&a[i]) == EOF){
return 0;
}
}

for(int i = 0; i < 8; i++){

for(int j = 0; j < 8; j++){

if(a[i][j] == 1){

if(i < 7 && j < 7){
if(a[i+1][j] == 1 && a[i][j+1] == 1 && a[i+1][j+1] == 1){
printf("A\n");
}
}
if(i < 5){
if(a[i+1][j] == 1 && a[i+2][j] == 1 && a[i+3][j] == 1){
printf("B\n");
}
}
if(j < 5){
if(a[i][j+1] == 1 && a[i][j+2] == 1 && a[i][j+3] == 1){
printf("C\n");
}
}
if(i < 6 && j < 5){
if(a[i][j+1] == 1 && a[i+1][j+1] == 1 && a[i+1][j+2] == 1){
printf("E\n");
}
}
if(i < 5 && j < 6){
if(a[i+1][j] == 1 && a[i+1][j+1] == 1 && a[i+2][j+1] == 1){
printf("F\n");
}
}
if(j > 0 && i < 6){
if(a[i+1][j] == 1 && a[i+1][j-1] == 1 && a[i+2][j-1] == 1){
printf("D\n");
}
}
if(j > 0 && j < 7 && i < 7){
if(a[i+1][j] == 1 && a[i][j+1] == 1 && a[i+1][j-1] == 1){
printf("G\n");
}
}

}

}

}

}

return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
char board1[15][15];
int board[15][15];
int x ;
int main()
{
  bool flag1 = false;
  while( 1 ){
    for(int i=0 ; i<8; i++) {
      if(scanf("%s", board1[i]) == EOF ){
	flag1 = true;
	break;
      }
    }
    for(int i = 0;i < 8;i++){
      for(int j = 0;j <8;j++){
	board[i][j] =board1[i][j]-'0';
      }
    }
    if(flag1)
      break;
    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][j+1]==1&&board[i+1][j] ==1&&board[i+1][j+1]==1){
	    cout <<"A"<<endl;
	    flag = true;
	  }else if(board[i+1][j]==1&&board[i+2][j]==1&&board[i+3][j]==1){
	    cout <<"B"<<endl;
	    flag = true;
	  }else if(board[i][j+1]==1&&board[i][j+2]==1&&board[i][j+3]==1){
	    cout <<"C"<<endl;
	    flag = true;
	  }else if(board[i+1][j-1]==1&&board[i+1][j]==1&&board[i+1][j]==1&&board[i+2][j-1]==1){
	    cout <<"D"<<endl;
	    flag = true;
	  }else if(board[i][j+1]==1&&board[i+1][j+1]==1&&board[i+1][j+2]==1){
	    cout <<"E"<<endl;
	    flag = true;
	  }else if(board[i+1][j]==1&&board[i+1][j+1]==1&&board[i+2][j+1]==1){
	    cout <<"F"<<endl;
	    flag = true;
	  }else if(board[i][j+1] ==1&&board[i+1][j-1] ==1&&board[i+1][j]==1){
	    cout <<"G"<<endl;
	    flag = true;
	  }
	}
 
      }

    }
  
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 8;

int main(void){
    for(vs t(N);;){
        int l = N, r = 0, u = N, d = 0;
        rep(i, N){
            if(!(cin >> t[i])) return 0;
            
            rep(j, N) if(t[i][j] == '1')
                l = min(l, j), r = max(r, j), 
                u = min(u, i), d = max(d, i);
        }
        int w = r - l + 1, h = d - u + 1;

        cout << (w == 4 ? 'C':h == 4 ? 'B':w == 2 ? h == 2 ? 'A': t[u][l] == '1' ? 'F':'D': t[u][l] == '1' ? 'E':'G') << endl;
    }
 
    return 0;
}

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

using namespace std;

constexpr size_t SIZE = 8;
constexpr size_t PATTERN = 7;

const array<string, PATTERN> pattern = {
    "1100000011", "1000000010000000100000001", "1111",
    "1000000110000001", "11000000011",
    "100000001100000001", "110000011"};

string surface;

char match();

int main()
{
    while (true) {
        surface = "";

        for (size_t row = 0; row < SIZE; row++) {
            string buf;
            cin >> buf;

            surface += buf;
        }

        cout << match() << endl;

        cin.ignore(2);
        if (cin.eof()) {
            break;
        }
    }

    return 0;
}

char match()
{
    for (size_t i = 0; i < PATTERN; i++) {
        if (surface.find(pattern.at(i), 0) != string::npos) {
            return static_cast<char>('A' + i);
        }
    }

    cout << "BUG!" << endl;
    return 'X';
}