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 <utility>
#include <vector>
#include <string>
using namespace std;

int main(void){
	string s[8];
	while(cin>>s[0]){
		std::vector<pair<int,int> > v;
		for(int i=1;i<8;i++)cin>>s[i];
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(s[i][j]=='1')v.push_back(make_pair(i,j));
			}
		}
		// second=x,first=y
		if(v[0].first==v[1].first&&v[0].second==v[2].second)cout<<"A"<<endl;
		else if(v[0].second==v[1].second&&v[2].second==v[1].second&&v[2].second==v[3].second)cout<<"B"<<endl;
		else if(v[2].first==v[0].first)cout<<"C"<<endl;
		else if(make_pair(v[0].first+2,v[0].second-1)==v[3])cout<<"D"<<endl;
		else if(make_pair(v[0].first+1,v[0].second+2)==v[3])cout<<"E"<<endl;
		else if(make_pair(v[9].first+2,v[0].second+1)==v[3])cout<<"F"<<endl;
		else cout<<"G"<<endl;
		// cin>>s[0]; // CRLF
	}
}

C++: 
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j,k;
  int n=8;
  vector<string> s;
  string t;
  while(cin>>t)s.push_back(t);

  rep(i,s.size()){
    for(j=i;j<i+n;j++)rep(k,n)if(s[j][k]=='1'){
	if(j+1<i+n && k+1<n && s[j][k+1]=='1' && s[j+1][k]=='1' && s[j+1][k+1]=='1')
	  cout<<"A"<<endl;
	if(j+3<i+n && s[j+1][k]=='1' && s[j+2][k]=='1' && s[j+3][k]=='1')
	  cout<<"B"<<endl;
	if(k+3<n && s[j][k+1]=='1' && s[j][k+2]=='1' && s[j][k+3]=='1')
	  cout<<"C"<<endl;
	if(j+2<i+n && k!=0 && s[j+1][k]=='1' && s[j+1][k-1]=='1' && s[j+2][k-1]=='1')
	  cout<<"D"<<endl;
	if(j+1<i+n && k+2<n && s[j][k+1]=='1' && s[j+1][k+1]=='1' && s[j+1][k+2]=='1')
	  cout<<"E"<<endl;
	if(j+2<i+n && k+1<n && s[j+1][k]=='1' && s[j+1][k+1]=='1' && s[j+2][k+1]=='1')
	  cout<<"F"<<endl;
	if(j+1<n+i && k && k+1<n && s[j][k+1]=='1' && s[j+1][k]=='1' && s[j+1][k-1]=='1')
	  cout<<"G"<<endl;
	goto END;
      }
  END:i+=n-1;
  }
}

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

int main(void) {
	int i;
	char field[65];
	char image[8][26] = {
		"1100000011",
		"1000000010000000100000001",
		"1111",
		"1000000110000001",
		"11000000011",
		"100000001100000001",
		"110000011"
	};

	while (cin >> field) {
		//cout<<field;
		for (i = 1; i < 8; i++) {
			cin >> image[7];
			strcat(field, image[7]);
			//cout<<field;
		}
		//cout<<endl;
		field[64] = '\0';
		for (i = 0; i < 7; i++) {
			char *pFind = strstr(field, image[i]);
			//cout<<pFind<<endl;
			if (pFind != NULL) {
				cout << char('A' + i) << endl;
				break;
			}
		}
	}

	return 0;
}

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

void solve(vector<vector<char> > a){
	for(int i = 0; i < 6; i++){
		for(int j = 0; j < 6; j++){
			if(a[i][j] == '1' && a[i + 1][j] == '1' && a[i][j + 1] == '1' && a[i + 1][j + 1] == '1'){
				cout << "A" << endl;
				return;
			}else if(a[i][j] == '1' && a[i + 1][j] == '1' && a[i + 2][j] == '1'){
				cout << "B" << endl;
				return;
			}else if(j > 0 && i > 0){
				if(a[i][j] == '1' && a[i - 1][j - 1] == '1' && a[i + 1][j] == '1' && a[i + 2][j + 1] == '1'){
					cout << "D" << endl;
					return;
				}else if(a[i][j] == '1' && a[i][j - 1] == '1' && a[i + 1][j] == '1' && a[i + 1][j + 1] == '1'){
					cout << "E" << endl;
					return;
				}else if(a[i][j] == '1' && a[i + 1][j] == '1' && a[i + 1][j + 1] == '1' && a[i + 2][j + 1] == '1'){
					cout << "F" << endl;
					return;
				}else if(a[i][j] == '1' && a[i][j + 1] == '1' && a[i + 1][j - 1] == '1' && a[i + 1][j] == '1'){
					cout << "G" << endl;
					return;
				}
			}
		}
	}
	cout << "C" << endl;
}

int main(){
	vector<vector<char> > a(8, vector<char>(8));
	for(int i = 0; i < 8; i++){
		for(int j = 0; j < 8; j++){
			cin >> a[i][j];
		}
	}
	solve(a);
}

C++: #include <iostream>
#include <string>
using namespace std;
#define N 8

int ptn[7]={18, 48, 6, 30, 20, 34, 16};

int main(void){
    string str,tmp;
	while (true){
		int i=0;
		getline(cin,tmp);
		if (cin.eof()) break;
		if (tmp.length()>0){
			str = tmp;
			i++;
		}else str = "";

		while (i<N){
			getline(cin,tmp);
			str+=tmp;
			i++;
		}
		int s=0, mini=(int)str.length();
		for (int i=0; i<str.length(); i++){
			if (str[i]=='1'){
				if (i<mini) mini =i;
				s+=i;
			}
		}
		s -= mini*4;
		for (int i=0; i<7; i++){
			if (ptn[i]==s){ 
				cout<<char(i+'A')<<endl;
				break;
			}
		}
	}
	return 0;
}