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: 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[j]) == 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: def get_data():
    array = []
    for i in range(8):
        array.append(input())
    return array

def judge():
    array = get_data()
    count = [[0 for i in range(8)] for i in range(8)]
    for i in range(8):
        x = 0
        for j in array[i]:
            if int(j) == 1:
                count[i][x] += 1
            x += 1

    a = 0
    p = []
    for i in range(8):
        for j in range(8):
            if count[i][j] != 0:
                p.append(a)
            a += 1

    if p[0]+1 != p[1]:
        if p[0] + 8*3 == p[3]:
            print('B')
        else:
            if p[0] + 8*2 + 1 == p[3]:
                print('F')
            else:
                print('D')
    else:
        if p[0]+1 == p[1] and p[1]+1 == p[2]:
            print('C')
        else:
            if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
                print('A')
            else:
                if p[0]+8*2 == p[2]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        judge()
    except:
        break

Python: while True:
    try:
        cnt = 0
        for i in range(8):
            inp = input()
            if cnt == 1:
                if inp.count("1") == 1:
                    print("B")
                elif inp.index("1") == ind:
                    print("F")
                else:
                    print("D")
                cnt = -1
            elif cnt == 2:
                if inp.index("1") == ind:
                    print("A")
                elif inp.index("1") == ind + 1:
                    print("E")
                else:
                    print("G")
                cnt = -1
            elif "1" in inp and cnt == 0:
                ind = inp.index("1")
                cnt = inp.count("1")
                if cnt == 4:
                    print("C")
                    cnt = -1
        inp = input()
    except:
        break

Python: # Aizu Problem 0036: Figure on Surface
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def get_figure(figure):
    for frow in range(8):
        if '1' in figure[frow]:
            fcol = figure[frow].find('1')
            break
    figure = figure[frow:]
    frow = 0
    ones = []
    min_col = 9
    for row in range(len(figure)):
        for col in range(8):
            if figure[row][col] == '1':
                ones.append([row, col])
                min_col = min(min_col, col)
    for k in range(len(ones)):
        ones[k][1] -= min_col
    if ones == [[0, 0], [0, 1], [1, 0], [1, 1]]:
        return 'A'
    elif ones == [[0, 0], [1, 0], [2, 0], [3, 0]]:
        return 'B'
    elif ones == [[0, 0], [0, 1], [0, 2], [0, 3]]:
        return 'C'
    elif ones == [[0, 1], [1, 0], [1, 1], [2, 0]]:
        return 'D'
    elif ones == [[0, 0], [0, 1], [1, 1], [1, 2]]:
        return 'E'
    elif ones == [[0, 0], [1, 0], [1, 1], [2, 1]]:
        return 'F'
    elif ones == [[0, 1], [0, 2], [1, 0], [1, 1]]:
        return 'G'
    else:
        return '?'

    
while True:
    figure = [input().strip() for _ in range(8)]
    print(get_figure(figure))
    try:
        dummy = input()
    except EOFError:
        break

Python: def main():
    while True:
        try:
            Array = []
            for _ in range(8):
                Array.append(list(map(int,input().strip())))
                if 1 not in Array[-1]:
                 Array.pop()
            if len(Array) == 1:
                print('C')
            elif len(Array) == 2:
                if Array[0].index(1) == Array[1].index(1):
                    print('A')
                elif Array[0].index(1) < Array[1].index(1):
                    print('E')
                else:
                    print('G')
            elif len(Array) == 3:
                if Array[0].index(1) > Array[2].index(1):
                    print('D')
                else:
                    print('F')
            else:
                print('B')
        except EOFError:
            break

if __name__ == '__main__':
    main()

Python: t=[{(0,1),(1,0),(1,1)},
   {(1,0),(2,0),(3,0)},
   {(0,1),(0,2),(0,3)},
   {(1,-1),(1,0),(2,-1)},
   {(0,1),(1,1),(1,2)},
   {(1,0),(1,1),(2,1)},
   {(0,1),(1,-1),(1,0)}
]

while 1:
    l=[input() for _ in range(8)]
    pos=sorted([(i,j) for i in range(8) for j in range(8) if l[i][j]=="1"])
    cv=lambda v:tuple([v[0]-pos[0][0],v[1]-pos[0][1]])
    pt=set(map(cv,pos))
    [print(chr(65+i)) for (i,j) in enumerate(t) if pt&j==j]
    try:
        input()
    except:
        break