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()
	}
}

Python: # 参考 http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2973729#1

def ans(sr, sc, tbl):
	if 4 in sr: return 'C'
	if 4 in sc: return 'B'
	if 1 in sr: return 'F' if tbl[sr.index(1)][sc.index(2)] == 1 else 'D'
	if 1 in sc: return 'E' if tbl[sr.index(2)][sc.index(1)] == 1 else 'G'
	return 'A'
	
tbl = [[] for i in range(8)]
sr, sc = [0]*8, [0]*8
while True:
	for r in range(8): tbl[r] = list(map(int, input()))
	# 行の総数
	for i in range(8): sr[i] = sum(tbl[i])
	# 列の総数
	for i in range(8): sc[i] = sum([tbl[r][i] for r in range(8)])
	print(ans(sr, sc, tbl))
	try: input()
	except: break

Python: flag = False
while True:
    try:
        string = [input() for _ in range(8)]
    except:
        break
    if flag:
        print()
    string = [int(l) for line in string for l in line] + [0]*16
    one = string.index(1)
    s = string[one:]
    ones = [[1, 8, 9], [8, 16, 24], [1, 2, 3],
            [7, 8, 15], [1, 9, 10], [8, 9, 17], [1, 7, 8]]
    ans = {0: "A", 1: "B", 2: "C", 3: "D", 4: "E", 5: "F", 6: "G"}
    for k, o in enumerate(ones):
        if all([s[o[0]], s[o[1]], s[o[2]]]):
            print(ans[k])
    flag = True

Python: maxl = 8

offsetV = ('A', 'B', 'C', 'D', 'E', 'F', 'G')
offset = (((0, 1), (1, 0), (1, 1)),
          ((0, 1), (0, 2), (0, 3)),
          ((1, 0), (2, 0), (3, 0)),
          ((0, 1), (-1, 1), (-1, 2)),
          ((1, 0), (1, 1), (2, 1)),
          ((0, 1), (1, 1), (1, 2)),
          ((1, 0), (-1, 1), (0, 1)),
          )


def match(l, x, y, oi):
    for offX, offY in [a for a in offset[oi]]:
        if 0 <= x + offX  <= maxl and 0 <= y + offY < maxl:
            pass
        else:
            return False

        if l[y + offY][x + offX] == '0':
            return False
    return True


def solve():
    l = [input() for i in range(9)]
    for y in range(7):
        for x in range(7):
            if l[y][x] == '1':
                for o in range(7):
                    if match(l, x, y, o):
                        return offsetV[o]



try:
    while 1:
        print(solve())
except:
    pass

Python: def block(b):
    for i in range(8):
        for j in range(8):
            if b[i][j] == 1:
                if sum(b[i]) == 4:
                    return 'C'
                if sum([b[t][j] for t in range(8)]) == 4:
                    return 'B'
                if sum(b[i]) == 2:
                    if b[i + 1][j] == 0:
                        return 'E'
                    if b[i + 1][j + 1] == 0:
                        return 'G'
                    return 'A'
                if j > 0 and b[i + 1][j - 1] == 1:
                    return 'D'
                return 'F'

while True:
    try:
        b = 8 * [8 * [0]]
        for i in range(8):
            b[i] = list(map(int, input()))
        print(block(b))
        input()
    except:
        break

Python: import sys


def analyze_figure(data):
    """
    ??????????????????????????§?????????????????£???????????????'1'????????£?????????????????¢??????
    ??????????????¨????????¶??????????????¢??????????????????
    """
    for i, row in enumerate(data):
        if '1' not in row:
            continue
        dot = row.count('1')
        if dot == 1:  # B, D, F???????????????
            x = row.index('1')
            try:
                if data[i+2][x] == '1':
                    return 'B'
                elif data[i+1][x+1] == '1':
                    return 'F'
                else:
                    return 'D'
            except IndexError:
                return None
        else:  # A, C, E, G???????????????
            x = row.index('1')
            try:
                if data[i][x+2] == '1':
                    return 'C'
                elif data[i+1][x] == '0':
                    return 'E'
                elif data[i+1][x+1] == '1':
                    return 'A'
                else:
                    return 'G'
            except IndexError:
                return None


if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append(line.strip())
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')
        # data.append('00000000')


        # ???????????????
        if len(data) == 8:
            ans = analyze_figure(data)

            # ???????????¨???
            if ans:
                print(ans)
            data = []

Python: while 1:
 a=[list(map(int,input()))for _ in[0]*8]
 y=[sum(r)for r in a]
 x=[sum(c)for c in zip(*a)]
 print('B'if 4 in x else'C'if 4 in y else'DF'[a[y.index(1)][x.index(2)]]if 1 in y else'GE'[a[y.index(2)][x.index(1)]]if 1 in x else'A')
 try:input()
 except:break

Python: shapes = {
    'A': '1100000011',
    'B': '1000000010000000100000001',
    'C': '1111',
    'D': '01000000110000001',
    'E': '11000000011',
    'F': '100000001100000001',
    'G': '0110000011'
}

while True:
    plane = ''
    for i in range(8):
        plane += input()

    for name in shapes:
        try:
            plane.index(shapes[name])
            print(name)
            break
        except:
            pass