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
}

var emptyBoard = [][]int{{0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0}}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, emptyBoard) {
			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)
		fmt.Scanln()
	}
}

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;
}