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 <vector>
#include <string>
#include <cstring>

class FIELD {
public:
  FIELD(int w, int h) : m_w(w), m_h(h) {
    m_pData = new char[m_w * m_h];
  }
  FIELD(int w, int h, const char* pc) : m_w(w), m_h(h) {
    m_pData = new char[m_w * m_h];
    for (int y = 0; y < m_h; y++) {
      for (int x = 0; x < m_w; x++) {
        at(x, y) = *(pc + x + y * m_w) == ' ' ? '0' : '1';
      }
    }
  }
  ~FIELD() {
    delete[] m_pData;
  }
  const char& at(int x, int y) const {
    return *(m_pData + x + y * m_w);
  }
  char& at(int x, int y) {
    return *(m_pData + x + y * m_w);
  }
  int GetWidth() const {
    return m_w;
  }
  int GetHeight() const {
    return m_h;
  }
  bool set() {
    for (int y = 0; y < m_h; y++) {
      std::string line;
      std::cin >> line;
      if (std::cin.eof()) {
        return false;
      }
      std::memcpy(m_pData + y * m_w, line.c_str(), m_w);
    }
    return true;
  }
  void echo() const {
    for (int y = 0; y < m_h; y++) {
      for (int x = 0; x < m_w; x++) {
        std::cout << at(x, y);
      }
      std::cout << std::endl;
    }
  }

private:
  int m_w;
  int m_h;

  char* m_pData;
};

static const FIELD patA(2, 2,
  "**"
  "**"
);

static const FIELD patB(1, 4,
  "*"
  "*"
  "*"
  "*"
);

static const FIELD patC(4, 1,
  "****"
);

static const FIELD patD(2, 3,
  " *"
  "**"
  "* "
);

static const FIELD patE(3, 2,
  "** "
  " **"
);

static const FIELD patF(2, 3, 
  "* "
  "**"
  " *"
);

static const FIELD patG(3, 2,
  " **"
  "** "
);

bool matchTemplate_core(const FIELD& src, const FIELD& templ, int x, int y) {

  for (int yy = 0; yy < templ.GetHeight(); yy++) {
    for (int xx = 0; xx < templ.GetWidth(); xx++) {
      if (src.at(x + xx, y + yy) != templ.at(xx, yy)) {
        return false;
      }
    }
  }

  return true;
}

bool matchTemplate(const FIELD& src, const FIELD& templ) {
  int rangeW = src.GetWidth() - templ.GetWidth();
  int rangeH = src.GetHeight() - templ.GetHeight();

  if (rangeW < 0 || rangeH < 0) {
    return false;
  }

  for (int y = 0; y <= rangeH; y++) {
    for (int x = 0; x <= rangeW; x++) {
      if (matchTemplate_core(src, templ, x, y)) {
        return true;
      }
    }
  }

  return false;
}

int main(void)
{
  FIELD f(8, 8);

  while (f.set()) {
    if (matchTemplate(f, patA)) std::cout << 'A' << std::endl;
    if (matchTemplate(f, patB)) std::cout << 'B' << std::endl;
    if (matchTemplate(f, patC)) std::cout << 'C' << std::endl;
    if (matchTemplate(f, patD)) std::cout << 'D' << std::endl;
    if (matchTemplate(f, patE)) std::cout << 'E' << std::endl;
    if (matchTemplate(f, patF)) std::cout << 'F' << std::endl;
    if (matchTemplate(f, patG)) std::cout << 'G' << std::endl;
  }

  return 0;
}

C++: #include <stdio.h>

int main() {
        const int N = 8;
        char mass[N][N + 1];

        while (scanf("%8s", &mass[0]) != EOF) {
                for (int i = 1; i < N; i++) {
                        scanf("%8s", &mass[i]);
                }
                int a, b;
                bool isFind = false;
                for (a = 0; a < N; a++) {
                        for (b = 0; b < N; b++) {
                                if (mass[a][b] == '1') {
                                        isFind = true;
                                        break;
                                }
                        }
                        if (isFind) {
                                break;
                        }
                }
                char ans;
                if (mass[a][b + 1] == '1' && mass[a + 1][b] == '1' &&
                                mass[a + 1][b + 1] == '1') {
                        ans = 'A';
                } else if (mass[a + 1][b] == '1' && mass[a + 2][b] == '1') {
                        ans = 'B';
                } else if (mass[a][b + 1] == '1' && mass[a][b + 2] == '1') {
                        ans = 'C';
                } else if (mass[a + 1][b - 1] == '1' && mass[a + 1][b] == '1') {
                        if (mass[a + 2][b - 1] == '1') {
                                ans = 'D';
                        } else {
                                ans = 'G';
                        }
                } else if (mass[a][b + 1] == '1' && mass[a + 1][b + 1] == '1') {
                        ans = 'E';
                } else if (mass[a + 1][b] == '1' && mass[a + 1][b + 1] == '1') {
                        ans = 'F';
                }
                printf("%c\n", ans);
        }

        return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	
	int d[64];
	char c[64];
	
	while(1){
		int k=0;
		for(int i=0;i<64;i++){c[i]=0;d[i]=0;}
		for(int i=0;i<64;i++){cin>>c[i];
			if(c[i]=='1'){d[k]=i;k+=1;}}
		if(k!=4)return 0;
		if(d[1]==d[0]+1){
			if(d[2]==d[0]+2)cout<<"C"<<endl;
			else if(d[2]==d[0]+7)cout<<"G"<<endl;
			else if(d[2]==d[0]+8)cout<<"A"<<endl;
			else cout<<"E"<<endl;
		}
		else if(d[1]==d[0]+8){
			if(d[2]==d[0]+16)cout<<"B"<<endl;
			else cout<<"F"<<endl;
		}
		else cout<<"D"<<endl;
	}
}