Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"reflect"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func scanBoard() [][]int {
	ret := make([][]int, 8)
	for k := range ret {
		ret[k] = make([]int, 8)
		for l := range ret[k] {
			ret[k][l] = 0
		}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		row := strings.Split(scanner.Text(), "")
		if reflect.DeepEqual(row, []string{}) {
			break
		}
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			break
		}
		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()
{
	int a[8][8];
	while(scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[0][0],&a[0][1],&a[0][2],&a[0][3],&a[0][4],&a[0][5],&a[0][6],&a[0][7])!=EOF)
	{
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[1][0],&a[1][1],&a[1][2],&a[1][3],&a[1][4],&a[1][5],&a[1][6],&a[1][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[2][0],&a[2][1],&a[2][2],&a[2][3],&a[2][4],&a[2][5],&a[2][6],&a[2][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[3][0],&a[3][1],&a[3][2],&a[3][3],&a[3][4],&a[3][5],&a[3][6],&a[3][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[4][0],&a[4][1],&a[4][2],&a[4][3],&a[4][4],&a[4][5],&a[4][6],&a[4][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[5][0],&a[5][1],&a[5][2],&a[5][3],&a[5][4],&a[5][5],&a[5][6],&a[5][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[6][0],&a[6][1],&a[6][2],&a[6][3],&a[6][4],&a[6][5],&a[6][6],&a[6][7]);
		scanf("%1d%1d%1d%1d%1d%1d%1d%1d",&a[7][0],&a[7][1],&a[7][2],&a[7][3],&a[7][4],&a[7][5],&a[7][6],&a[7][7]);
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				if(a[x][y]==1)
				{
					if(a[x][y+1]==1)
					{
						if(a[x+1][y]==1)
						{
							if(a[x+1][y+1])
							{						
								printf("A\n");
							}
							else if(a[x+1][y-1])
							{
								printf("G\n");
							}
						}
						else if(a[x][y+2]==1&&a[x][y+3]==1)
						{
							printf("C\n");
						}
						else if(a[x+1][y+1]==1&&a[x+1][y+2]==1)
						{
							printf("E\n");
						}
					}
					else if(a[x+1][y]==1)
					{
						if(a[x+2][y]==1&&a[x+3][y]==1)
						{
							printf("B\n");
						}
						else if(a[x+1][y-1]==1&&a[x+2][y-1]==1)
						{
							printf("D\n");
						}
						else if(a[x+1][y+1]==1&&a[x+2][y+1]==1)
						{
							printf("F\n");
						}
					}
					x=10;
					y=10;
				}
			}
		}
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int a[15][15]={};
int main ()
{
	while(cin>>a[0][0])
	{
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				if(x==0&&y==0)continue;
				cin>>a[x][y];
			}
		}
		
		for(int x=0;x<8;x++)
		{
			for(int y=0;y<8;y++)
			{
				if(a[x][y]&&a[x+1][y]&&a[x][y+1]&&a[x+1][y+1])
				{
					cout<<"A"<<endl;
				}
				else if(a[x][y]&&a[x][y+1]&&a[x][y+2]&&a[x][y+3])
				{
					cout<<"B"<<endl;
				}
				else if(a[x][y]&&a[x+1][y]&&a[x+2][y]&&a[x+3][y])
				{
					cout<<"C"<<endl;
				}
				else if(a[x+1][y]&&a[x][y+1]&&a[x+1][y+1]&&a[x][y+2])
				{
					cout<<"D"<<endl;
				}
				else if(a[x][y]&&a[x+1][y]&&a[x+1][y+1]&&a[x+2][y+1])
				{
					cout<<"E"<<endl;
				}
				else if(a[x][y]&&a[x][y+1]&&a[x+1][y+1]&&a[x+1][y+2])
				{
					cout<<"F"<<endl;
				}
				else if(a[x+1][y]&&a[x+2][y]&&a[x][y+1]&&a[x+1][y+1])
				{
					cout<<"G"<<endl;
				}
			}
		}
	}
}

C++: input_lines = int(input())
for i in range(input_lines):
  s = i
 
#for i range 8:
    

print (s)

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

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

inline bool domain(int i, int j){
  if(i < 8 && j < 8 && 0 <= i && 0 <= j) return true;
  else return false;
}

int main(){
  int i,j,k,n;
  vector<string> in(8);

  while(cin >> in[0] >> in[1] >> in[2] >> in[3] >> in[4] >> in[5] >> in[6] >> in[7]){
    rep(i,in.size()) rep(j,in[i].size()){
      if(in[i][j] == '1'){
        if(domain(i+1,j) && in[i+1][j] == '1' &&
           domain(i,j+1) && in[i][j+1] == '1' &&
           domain(i+1,j+1) && in[i+1][j+1] == '1'){
          cout << "A" << endl;
        }

        if(domain(i+1,j) && in[i+1][j]  == '1' &&
           domain(i+2,j) && in[i+2][j] == '1' &&
           domain(i+3,j) && in[i+3][j] == '1' ){
          cout << "B" << endl;
        }

        if(domain(i,j+1) && in[i][j+1] == '1' &&
           domain(i,j+2) && in[i][j+2] == '1' &&
           domain(i,j+3) && in[i][j+3] == '1' ){
          cout << "C" << endl;
        }

        if(domain(i+1,j) && in[i+1][j] == '1' &&
           domain(i+1,j-1) && in[i+1][j-1] == '1' &&
           domain(i+2,j-1) && in[i+2][j-1] == '1' ){
          cout << "D" << endl;
        }

        if(domain(i,j+1) && in[i][j+1] == '1' &&
           domain(i+1,j+1) && in[i+1][j+1] == '1' &&
           domain(i+1,j+2) && in[i+1][j+2] == '1' ){
          cout << "E" << endl;
        }

        if(domain(i+1,j) && in[i+1][j] == '1' &&
           domain(i+1,j+1) && in[i+1][j+1] == '1' &&
           domain(i+2,j+1) && in[i+2][j+1] == '1' ){
          cout << "F" << endl;
        }

        if(domain(i,j+1) && in[i][j+1] == '1' &&
           domain(i+1,j) && in[i+1][j] == '1' &&
           domain(i+1,j-1) && in[i+1][j-1] == '1' ){
          cout << "G" << endl;
        }
      }
    }
  }

  return 0;
}

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

int main(){
	char p[7][18] = {"1100000011", "10000000100000001", "1111", "1000000110000001", "11000000011", "10000000110000000", "110000011"};
	char f[65];
	char t;
	while(1 + scanf("%c", &t)){
		if(t-10){
			f[0] = t;
		}else{
			scanf("%c", &f[0]);
		}
		for(int i = 1; i < 64; i++){
			scanf("%c", &t);
			if(t - 10){
				f[i] = t;
			}else{
				i--;
			}
		}
		f[64] = '\0';
		for(int i = 0; i < 7; i++){
			if(strstr(f, p[i])){
				printf("%c\n", i + 'A');
			}
		}
	}
	return 0;
}