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 <deque>
#include <vector>
#include <iostream>
#include <cassert>

using namespace std;

template<typename T>
class matrix2d {
public:
	matrix2d(size_t width, size_t height) : width_(width), height_(height), data_(width*height, T()) {}

	T&       at(size_t x, size_t y)       { return data_[width_ * y + x]; }
	const T& at(size_t x, size_t y) const { return data_[width_ * y + x]; }

	size_t width()  const { return width_; }
	size_t height() const { return height_; }

private:
	size_t width_;
	size_t height_;
	deque<T> data_;
};

class block {
public:
	block(size_t width, size_t height, const char *blocks) : data_(width, height) {
		for (size_t y = 0; y < height; y++) {
			for (size_t x = 0; x < width; x++) {
				data_.at(x, y) = (blocks[width * y + x] == '1') ? 1 : 0;
			}
		}
		assert(blocks[width*height] == 0);
	}

	int&       at(size_t x, size_t y)       { return data_.at(x, y); }
	const int& at(size_t x, size_t y) const { return data_.at(x, y); }

	size_t width() const { return data_.width(); }
	size_t height() const { return data_.height(); }

private:
	matrix2d<int> data_;
};

class field {
public:
	field(size_t width, size_t height) : data_(width, height) {}

	int& at(size_t x, size_t y) { return data_.at(x, y); }

	bool contains(const block& b) const {
		for (int y = 0; y < data_.height(); y++) {
			for (int x = 0; x < data_.width(); x++) {
				if (x + b.width() > data_.width()) {
					break;
				}
				if (match(b, x, y)) {
					return true;
				}
			}
			if (y + b.height() > data_.height()) {
				break;
			}
		}
		return false;
	}

private:
	bool match(const block& b, int left, int top) const {
		for (int dy = 0; dy < b.height(); dy++) {
			for (int dx = 0; dx < b.width(); dx++) {
				if (data_.at(left + dx, top + dy) != b.at(dx, dy)) {
					return false;
				}
			}
		}
		return true;
	}

	matrix2d<int> data_;
};

typedef pair<block, char> block2name;

block2name make_block(const char* data, size_t width, size_t height, char name) {
	return make_pair(block(width, height, data), name);
}

int main(void) {
	vector<block2name> blocks;

	blocks.push_back(make_block(
		"11"
		"11", 2, 2, 'A'));

	blocks.push_back(make_block(
		"1"
		"1"
		"1"
		"1", 1, 4, 'B'));

	blocks.push_back(make_block(
		"1111", 4, 1, 'C'));

	blocks.push_back(make_block(
		" 1"
		"11"
		"1 ", 2, 3, 'D'));

	blocks.push_back(make_block(
		"11 "
		" 11", 3, 2, 'E'));

	blocks.push_back(make_block(
		"1 "
		"11"
		" 1", 2, 3, 'F'));

	blocks.push_back(make_block(
		" 11"
		"11 ", 3, 2, 'G'));

	while (!cin.eof()) {
		field f(8, 8);
		char c;	
		for (int y = 0; y < 8; y++) {
			for (int x = 0; x < 8; x++) {
				cin >> c;
				f.at(x, y) = (c == '1') ? 1 : 0;
			}
		}

		for (int i = 0; i < blocks.size(); i++) {
			if (f.contains(blocks[i].first)) {
				cout << blocks[i].second << endl;
				break;
			}
		}
	}
}

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>
#include <cstdio>
using namespace std;

char field[8][9];
struct P { int x, y; };
P pat[7][3] = {
	{{1,0}, {0,1}, {1,1}},
	{{0,1}, {0,2}, {0,3}},
	{{1,0}, {2,0}, {3,0}},
	{{-1,1}, {0,1}, {-1,2}},
	{{1,0}, {1,1}, {2,1}},
	{{0,1}, {1,1}, {1,2}},
	{{1,0}, {-1,1}, {0,1}},
};

bool ok(int x, int y) {
	if (x<0 || x>=8 || y<0 || y>=8) return false;
	return (field[y][x] == '1');
}

int main() {
	while (scanf("%s", &field[0]) == 1) {
		for (int i = 1; i < 8; i++)
			scanf("%s", &field[i]);

		int x0, y0;
		for (int i = 0; i < 8*8; i++) {
			int x = i%8, y = i/8;
			if (ok(x, y)) {
				x0 = x, y0 = y;
				break;
			}
		}

		char kind;
		for (int i = 0; i < 7; i++) {
			if (!ok(x0+pat[i][0].x, y0+pat[i][0].y)) continue;
			if (!ok(x0+pat[i][1].x, y0+pat[i][1].y)) continue;
			if (!ok(x0+pat[i][2].x, y0+pat[i][2].y)) continue;
			kind = 'A' + i;
			break;
		}

		cout << kind << endl;
	}
	return 0;
}

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

using namespace std;

char field[8][8];

bool check(int y,int x){
	return 0<=y && y<8 && 0<=x && x<8 && field[y][x];
}

int main(void){
	int i,j,y,x;

	while(cin>>field[0]){
		for(i=1;i<8;i++){
			cin>>field[i];
		}

		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				field[i][j]-='0';
			}
		}

		for(y=0;y<8;y++){
			for(x=0;x<8;x++){
				if(field[y][x]==1){
					if(check(y+1,x) && check(y+2,x)) cout<<"B"<<endl;
					else if(check(y,x+1) && check(y,x+2)) cout<<"C"<<endl;
					else if(check(y+1,x) && check(y,x+1) && check(y+1,x+1)) cout<<"A"<<endl;
					else if(check(y+1,x) && check(y+1,x-1) && check(y+2,x-1)) cout<<"D"<<endl;
					else if(check(y,x+1) && check(y+1,x+1) && check(y+1,x+2)) cout<<"E"<<endl;
					else if(check(y+1,x) && check(y+1,x+1) && check(y+2,x+1)) cout<<"F"<<endl;
					else if(check(y,x+1) && check(y+1,x) && check(y+1,x-1)) cout<<"G"<<endl;
					y=x=8;
				}
			}
		}
	}
	return 0;
}