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 <bits/stdc++.h>

using namespace std;

char x[7][4][5] = {
  {
    "1100",
    "1100",
    "0000",
    "0000"
  },
  {
    "1000",
    "1000",
    "1000",
    "1000"
  },
  {
    "1111",
    "0000",
    "0000",
    "0000"
  },
  {
    "0100",
    "1100",
    "1000",
    "0000"
  },
  {
    "1100",
    "0110",
    "0000",
    "0000"
  },
  {
    "1000",
    "1100",
    "0100",
    "0000"
  },
  {
    "0110",
    "1100",
    "0000",
    "0000"
  }
};

int main(void) {
  vector<string> input(8);
  while (cin >> input[0]) {
    for (int i = 1; i < 8; i++) {
      cin >> input[i];
    }

    char s[11][11];
    memset(s, '0', sizeof(s));

    for (int i = 0; i < 8; i++) {
      for (int j = 0; j < 8; j++) {
        s[i][j] = input[i][j];
      }
    }

    int ans = -1;
    for (int i = 0; i < 7; i++) {
      for (int j = 0; j < 8; j++) {
        for (int k = 0; k < 8; k++) {
          bool find = true;
          for (int l = 0; l < 4; l++) {
            for (int m = 0; m < 4; m++) {
              find &= s[j + l][k + m] == x[i][l][m]; 
            }
          }
          if (find) ans = i;
        }
      }
    }

    cout << (char)(ans + 'A') << endl;
  }

  return 0;
}

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

int main(void) {

  int fig[64];

  char buf[10];
  
  int i,j;

  while(1) {
  for(i=0;i<8;i++) {

    if(fgets(buf,sizeof(buf),stdin)==NULL) return 0;
    buf[strlen(buf)-1]='\0';

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

      fig[8*i+j]=(int)buf[j]-48;

    }

  }

  /*for(i=0;i<64;i++) {

    printf("%d ",fig[i]);

    }*/

  for(i=0;i<64;i++) {

    if(fig[i]==1) {

      //A or C or E or G
      if(fig[i+1]==1) {

	if(fig[i+2]==1) {
	  printf("C\n");
	  break;
	}

	else if(fig[i+10]==1) {
	  printf("E\n");
	  break;
	}

	else if(fig[i+7]==1) {
	  printf("G\n");
	  break;
	}

	else {
	  printf("A\n");
	  break;
	}

      }

      //B or D or F
      else if(fig[i+8]==1) {

	if(fig[i+16]==1) {
	  printf("B\n");
	  break;
	}

	if(fig[i+7]==1) {
	  printf("D\n");
	  break;
	}

	if(fig[i+9]==1) {
	  printf("F\n");
	  break;
	}

      }

    }

  }

  //ツ凝ウツ板陳禿づ敖氾イツづ篠つオ
  fgets(buf,sizeof(buf),stdin);
  }
  return 0;

}

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

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	bool br = false;
	while (true){
		if (cin.eof())
			break;
		bool cell[8][8] = { false };
		int ans = 0;
		string s;
		getline(cin, s);
		if (s.empty())
			continue;
		REP(j, 8){
			if (s[j] == '1')
				cell[0][j] = true;
		}
		REP(i, 7){
			REP(j, 8){
				if (s[j] == '1')
					cell[i+1][j] = true;
			}
		}
		if (br)
			break;
		REP(i, 8){
			REP(j, 8){
				if (cell[i][j]){
					REP(k, 3)
						REP(l, 3)
						if (i + (k - 1) >= 0 && i + (k - 1) < 8 && j + (l - 1) >= 0 && j + (l - 1) < 8 && cell[i + (k - 1)][j + (l - 1)])
							ans += 1 << (8 - (k * 3 + l));
					i = 8;
					j = 8;
				}
			}
		}
		switch (ans){
		case 27:
			cout << 'A' << endl;
			break;
		case 18:
			cout << 'B' << endl;
			break;
		case 24:
			cout << 'C' << endl;
			break;
		case 22:
			cout << 'D' << endl;
			break;
		case 25:
			cout << 'E' << endl;
			break;
		case 19:
			cout << 'F' << endl;
			break;
		case 30:
			cout << 'G' << endl;
			break;
		}
	}
}

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

vector<string> field(11);

int main() {
    string s;
    while (cin >> s) {
        field[0] = "000" + s + "000";
        for (int i = 1; i < 8; i++) {
            cin >> s;
            field[i] = "000" + s + "000";
        }
        for (int i = 8; i < 11; i++) {
            field[i] = "00000000000000";
        }
        int x, y;
        for (int i = 0; i < 8; i++) {
            for (int j = 3; j < 11; j++) {
                if (field[i][j] == '1') {
                    y = i, x = j;
                    goto end;
                }
            }
//            cout << endl;
        } 
end:

//        for (int i = 0; i < 8; i++) {
//            for (int j = 3; j < 11; j++) {
//                cout << field[i][j] << ' ';
//            }
//            cout << endl;
//        }

        char ans;
//        cout << x << ' ' << y << endl;
        if (field[y][x+1] == '1') {
            if (field[y][x+3] == '1') ans = 'C';
            else if (field[y+1][x-1] == '1') ans = 'G';
            else if (field[y+1][x+2] == '1') ans = 'E';
            else if (field[y+1][x] == '1') ans = 'A';
        } else {
            if (field[y+3][x] == '1') ans = 'B';
            else if (field[y+1][x-1] == '1') ans = 'D';
            else ans = 'F';
        }
        cout << ans << endl;
    }
    return 0;
}