Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	board := make([][]int, 8)
	for i := range board {
		board[i] = make([]int, 8)
			for j := range board[i] {
				board[i][j] = 0
			}
	}
	var ans string
	for scanner.Scan() {
		tmp := strings.Split(scanner.Text(), "")
		for i := 0; i < 8; i++ {
			board[0][i], _ = strconv.Atoi(tmp[i])
		}
		for i := 1; i < 8; i++ {
			scanner.Scan()
			row := strings.Split(scanner.Text(), "")
			for j := 0; j < 8; j++ {
				board[i][j], _ = strconv.Atoi(row[j])
			}
		}
		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)
	}
}

Python: def judge(array):
    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 == p[3]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        array = []
        for i in range(8):
            array.append(input())
        judge(array)
        input()
    except:
        break

Python: while True:
    squares = [list(input()) for _ in range(8)]
    for i in range(8)[::-1]:
        if not squares[i].count('1'):
            del squares[i]
    for i in range(8)[::-1]:
        if not [line[i] for line in squares].count('1'):
            for j in range(len(squares)):
                del squares[j][i]
    if len(squares) == len(squares[0]):
        print('A')
    elif len(squares) == 4:
        print('B')
    elif len(squares) == 1:
        print('C')
    elif squares[0] == ['0', '1']:
        print('D')
    elif squares[0] == ['1', '1', '0']:
        print('E')
    elif squares[0] == ['1', '0']:
        print('F')
    elif squares[0] == ['0', '1', '1']:
        print('G')
    try:
        input()
    except:
        break

Python: import sys
 
counter = 0
block = []
for line in sys.stdin:
  if line == "\n":
    counter = -1
    block = []
  else:
    counter += 1
    for i in line:
      if i == "1":
        block.append([counter,line.index(i)])
  if counter == 7:
    if block[0][0] == block[1][0]:
      if block[1][0] == block[2][0]:
        print("C")
      elif block[0][1] == block[2][1]:
        print("A")
      elif block[0][1] < block[2][1]:
        print("E")
      else:
        print("G")
    else:
      if block[0][1] == block[3][1]:
        print("B")
      elif block[0][1] < block[3][1]:
        print("F")
      else:
        print("D")

Python: # -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

s=[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,1,1,0,0,0,0,0],[0,0,1,1,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]]
s2=[[0,0,0,1,1,1,1,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]]
s3=[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,1,1,0,0,0,0],[0,0,1,1,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]]

#はじめに1に当たる座標のみを取得し、その座標の右隣り＝r、下隣=b、みぎした隣=nより探索する
def Sakana(s):
    for i in range(0,len(s)-1):
        #print ("a")
        for o in range(0,len(s[i])-1):
            #print (s[i][o])
            if s[i][o]==1:
                #下
                b=s[i+1][o]
                #右
                r=s[i][o+1]
                #右斜めした
                n=s[i+1][o+1]
                    
                #判定
                if b==1 and r==1 and n==1:
                    return "A"
                if b==1 and r==1 and n==0:
                    return "G"
                if b==0 and r==1 and n==0:
                    return "C"
                if b==1 and r==0 and n==0:
                    if s[i+2][o] == 0:
                        return "D"
                    else:
                        return "B"
                if b==1 and r==0 and n==1:
                    return "F"
                if b==0 and r==1 and n==1:
                    return "E"
                break

print(Sakana(s))
print(Sakana(s2))
print(Sakana(s3))

Python: def solve():
    line = input()
    while True:
        surface = list(map(int, line))
        for _ in range(7):
            surface.extend(map(int, input()))
        
        for i, v in enumerate(surface):
            if not v == 1:
                continue
            
            # A
            if i+9 < 64 and surface[i+1] == 1 and surface[i+8] == 1 and surface[i+9] == 1:
                print('A')
                break
            
            # B
            if i+24 < 64 and surface[i+24] == 1:
                print('B')
                break
            
            # C
            if surface[i+3] == 1:
                print('C')
                break
            
            # D
            if i+15 < 64 and surface[i+15] == 1:
                print('D')
                break
            
            # E
            if i+10 < 64 and surface[i+10] == 1:
                print('E')
                break
            
            # F
            if i+17 < 64 and surface[i+17] == 1:
                print('F')
                break
            
            # G
            if surface[i+1] == 1 and surface[i+7] == 1 and surface[i+8] == 1:
                print('G')
                break
            
        
        try:
            input()
            line = input()
        except EOFError:
            break
    

if __name__ == "__main__":
    solve()

Python: while 1:
	try:
		pos=[]
		for i in xrange(8):
			s=raw_input()
			for j in xrange(8):
				if int(s[j])==1:
					pos.append([i,j])
		if pos[0][0]+1==pos[3][0] and pos[0][1]+1==pos[3][1]:
			print('A')
		elif pos[0][0]+3==pos[3][0]:
			print('B')
		elif pos[0][1]+3==pos[3][1]:
			print('C')
		elif pos[0][1]==pos[3][1]-1:
			print('D')
		elif pos[0][0]+1==pos[3][0] and pos[0][1]+2==pos[3][1]:
			print('E')
		else:
			print('F')
		raw_input()
	except:
		break