Problem:


平面上の図形

縦 8、横 8 のマスからなる図 1 のような平面があります。

□□□□□□□□

□□□□□□□□

□□□□□□□□

□□□□□□□□

□□□□□□□□

□□□□□□□□

□□□□□□□□

□□□□□□□□

図１

この平面上に、以下の A から G の図形のどれかが一つだけ置かれています。

	

A

	

		
■■

		
■■

		

		

	

	

B

	

		
■

		
■

		
■

		
■

	

	

C

	

		
■■■■

		

		

		

	

	

D

	

		
■

		
■■

		
■

		

	

	

E

	

		
■■

		
■■

		

		

	

	

F

	

		
■

		
■■

		
■

		

	

	

G

	

		
■■

		
■■

		

		

	

		

たとえば、次の図 2 の例では E の図形が置かれています。

□□□□□□□□

□□□□□□□□

□■■□□□□□

□□■■□□□□

□□□□□□□□

□□□□□□□□

□□□□□□□□

□□□□□□□□

図２

平面の中で図形が占めているマスを 1、占めていないマスを 0 で表現した数字の列を読み込んで、置かれている図形の種類（A〜G）を出力するプログラムを作成してください。

ただし、ひとつの平面に置かれている図形は必ず１つで、複数の図形が置かれていることはありません。また、A〜G で表される図形以外のものが置かれていることはありません。

Input

入力は複数のデータセットからなります。

１つのデータセットとして、平面の中で図形が占めているマスを 1、占めていないマスを 0 で表現した 8 文字からなる 8 つの文字列が与えられます。例えば、図 2 に対応する文字列の並びは次のようになります。

00000000

00000000

01100000

00110000

00000000

00000000

00000000

00000000

データセットの間は１つの空行で区切られています。データセットの数は 50 を超えません。

Output

各データセットごとに、平面に与えられた図形の種類（A〜G のいずれか）を１行に出力してください。

Sample Input

00000000
00000000
01100000
00110000
00000000
00000000
00000000
00000000

00011110
00000000
00000000
00000000
00000000
00000000
00000000
00000000

00000000
00000000
00110000
00110000
00000000
00000000
00000000
00000000

Output for the Sample Input

E
C
A



Sample input:
00000000
00000000
01100000
00110000
00000000
00000000
00000000
00000000

00011110
00000000
00000000
00000000
00000000
00000000
00000000
00000000

00000000
00000000
00110000
00110000
00000000
00000000
00000000
00000000


Sample output:
E
C
A

Submission status: Runtime Error

Solution code:
import sys

for s in sys.stdin:
    a_b = True
    for i in range(8):
        for j in range(8):
            ss = s.splitlines()[i][j]
            if int(ss) == 1 and a_b:
                a_b, a_v = False, (i, j)
            if int(ss) == 1 and not a_b:
                z_v = (i, j)
    if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
        print("A")
    elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
        print("B")
    elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
        print("C")
    elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
        print("D")
    elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
        print("E")
    elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
        print("F")
    else:
        print("G")

Submission status: Runtime Error

Solution code:
s = []
while True:
    try:
        s = [input()+"\n" for _ in range(8)]
    except:
        break
    a_b = True
    for i in range(8):
        for j in range(8):
            ss = s.splitlines()[i][j]
            if int(ss) == 1 and a_b:
                a_b, a_v = False, (i, j)
            if int(ss) == 1 and not a_b:
                z_v = (i, j)
    if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
        print("A")
    elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
        print("B")
    elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
        print("C")
    elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
        print("D")
    elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
        print("E")
    elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
        print("F")
    else:
        print("G")

Submission status: Runtime Error

Solution code:
s = []
while True:
    try:
        s = [input() for _ in range(8)]
    except:
        break
    a_b = True
    for i in range(8):
        for j in range(8):
            ss = s[i][j]
            if int(ss) == 1 and a_b:
                a_b, a_v = False, (i, j)
            if int(ss) == 1 and not a_b:
                z_v = (i, j)
    if a_v[0]+1==z_v[0] and a_v[1]+1==z_v[1]:
        print("A")
    elif a_v[0]+3==z_v[0] and a_v[1]==z_v[1]:
        print("B")
    elif a_v[0]==z_v[0] and a_v[1]+3==z_v[1]:
        print("C")
    elif a_v[0]+2==z_v[0] and a_v[1]-1==z_v[1]:
        print("D")
    elif a_v[0]+1==z_v[0] and a_v[1]+2==z_v[1]:
        print("E")
    elif a_v[0]+2==z_v[0] and a_v[1]+1==z_v[1]:
        print("F")
    else:
        print("G")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
figures = {
    'A': [['1', '1'], ['1', '1']],
    'B': [['1'], ['1'], ['1'], ['1']],
    'C': [['1', '1', '1', '1']],
    'D': [['0', '1'], ['1', '1'], ['1', '0']],
    'E': [['1', '1', '0'], ['0', '1', '1']],
    'F': [['1', '0'], ['1', '1'], ['0', '1']],
    'G': [['0', '1', '1'], ['1', '1', '0']],
}


def f1(lines):
    for n, figure in figures.items():
        found = f2(lines, figure)
        if found:
            print(n)
            break


def f2(lines, figure):
    height = len(figure)
    width = len(figure[0])
    for h in range(8 - height + 1):
        for w in range(8 - width + 1):
            found = f3(lines, figure, height, width, h, w)
            if found:
                return True


def f3(lines, figure, height, width, h, w):
    _figure = [[lines[h+_h][w+_w] for _w in range(width)]
               for _h in range(height)]
    if figure == _figure:
        return True


try:
    while True:
        f1([list(input()) for _ in range(8)])
except EOFError:
    pass

Submission status: Runtime Error

Solution code:
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 EOFError:
        break

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
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 EOFError:
        break

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
while True:
    string = [input() for _ in range(8)]
    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])
    try:
        input()
    except:
        break

Submission status: Runtime Error

Solution code:
while True:
    try:
        string = [input() for _ in range(8)]
        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])
        input()
    except:
        break

Submission status: Runtime Error

Solution code:
while True:
	try:
		x=[[int(i) for i in input()] for j in range(8)]
		count=0
		num=[]
		for i in range(8):
			if x[i].count(1)!=0:
				num.append(i)
				count+=1
		if count==1:
			print("C")
		elif count==4:
			print("B")
		elif count==2:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						if x[num[0]+1][j]==1:
							print("A")
						else:
							print("E")
					else:
						if x[num[0]+1][j-1]==1:
							print("G")
						else:
							if x[num[0]+1][j]==1:
								print("A")
							else:
								print("E")
					break
		else:
			for j in range(8):
				if x[num[0]][j]==1:
					if j==0:
						print("F")
					else:
						if x[num[0]][j-1]==1:
							print("D")
						else:
							print("F")
					break
			
	except EOFError:
		break

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
while True:
    try:
        l = []
        for i in range(8):
            l += list(map(int, input()))
    except:
        break

    cnt = 0
    for i in range(len(l)):
        if l[i]:
            cnt += i
    cnt -= l.index(1) * 4

    if cnt == 18:
        ans = "A"
    elif cnt == 48:
        ans = "B"
    elif cnt == 6:
        ans = "C"
    elif cnt == 34:
        ans = "D"
    elif cnt == 20:
        ans = "E"
    elif cnt == 34:
        ans = "F"
    else:
        ans = "G"

    print(ans)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

input_lines = int(input())
for i in range(input_lines):
  s = input().rstrip().split("\n")
 
for i range 8:
    

print (s)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

input_lines = int(input())
for i in range(input_lines):
  s = input().rstrip().split("\n")
 
#for i range 8:
    

print (s)

Submission status: Runtime Error

Solution code:
import sys
l=[t for t in sys.stdin]
i=0
while 1:
    pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
    if not pt:break
    if len(pt)==1:print("C")
    elif len(pt)==2 and pt[0]==pt[1]:print("A")
    elif len(pt)==2 and pt[0]<pt[1]:print("E")
    elif len(pt)==2 and pr[0]>pt[1]:print("G")
    elif len(pt)==3 and pt[0]>pt[1]:print("D")
    elif len(pt)==3 and pt[0]<pt[1]:print("F")
    else: print("B")
    i+=1

Submission status: Runtime Error

Solution code:
import sys
l=[t for t in sys.stdin]
i=0
while 1:
    pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
    if not pt:break
    if len(pt)==1:print("C")
    elif len(pt)==2
        if pt[0]==pt[1]:print("A")
        elif pt[0]<pt[1]:print("E")
        elif pr[0]>pt[1]:print("G")
    elif len(pt)==3
        if pt[0]>pt[1]:print("D")
        elif pt[0]<pt[1]:print("F")
    else: print("B")
    i+=1

Submission status: Runtime Error

Solution code:
import sys
l=[t for t in sys.stdin]
i=0
while 1:
    pt=[i.find("1") for i in l[9*i:9*(i+1)] if i.find("1")!=-1]
    if not pt:break
    if len(pt)==1:print("C")
    elif len(pt)==2:
        if pt[0]==pt[1]:print("A")
        elif pt[0]<pt[1]:print("E")
        elif pr[0]>pt[1]:print("G")
    elif len(pt)==3:
        if pt[0]>pt[1]:print("D")
        elif pt[0]<pt[1]:print("F")
    else: print("B")
    i+=1

Submission status: Runtime Error

Solution code:
ans = {18:'A',48:'B',3:'C',30:'D',20:'E',34:'F',16:'G'}
while True:
  s = 0
  d = -1
  for i in range(8):
    try:
      line = raw_input()
    except EOFError:
      break
    for (j, c) in enumerate(list(line)):
      if c == '1':
        if d < 0:
          d = 8*i + j
        s += 8 * i + j - d
  raw_input()
  print ans[s]

Submission status: Runtime Error

Solution code:
while True:
    try:

        a = [[0 for j in range(8)]for i in range(8)]

        for i in range(8):
            a[i] = list(map(int,raw_input()))

        f = 0

        for i in range(8):

            if f == 1:
                f = 0
                break

            for j in range(8):
                if a[i][j] == 1:
                    if a[i][j+1] == 1:

                        if a[i][j+2] == 1:
                            print "C"
                            f = 1
                            break

                        elif a[i+1][j] == 1:

                            if a[i+1][j+1] == 1:
                                print "A"
                                f = 1
                                break
                            if a[i+1][j-1] == 1:
                                print "G"
                                f = 1
                                break

                        else:
                            print "E"
                            f = 1
                            break

                    elif a[i+1][j] == 1:

                        if a[i+2][j] == 1:
                            print "B"
                            f = 1
                            break

                        elif a[i+1][j+1] == 1:
                            print "F"
                            f = 1
                            break

                        else:
                            print "D"
                            f = 1
                            break

    except EOFError:
        break

Submission status: Runtime Error

Solution code:
while True:
    try:

        a = [[0 for j in range(8)]for i in range(8)]

        for i in range(8):
            a[i] = list(map(int,raw_input()))

        f = 0 

        i = 0 
        j = 0                                                                                                                                                                                                                                                                                                                  

        for i in range(8):

            if f == 1:
                f = 0 
                break

            for j in range(8):
                if a[i][j] == 1:
                    if a[i][j+1] == 1:

                        if a[i][j+2] == 1:
                            print "C" 
                            f = 1 
                            break

                        elif a[i+1][j] == 1:

                            if a[i+1][j+1] == 1:
                                print "A" 
                                f = 1 
                                break
                            if a[i+1][j-1] == 1:
                                print "G" 
                                f = 1 
                                break

                        else:
                            print "E" 
                            f = 1 
                            break

                    elif a[i+1][j] == 1:

                        if a[i+2][j] == 1:
                            print "B" 
                            f = 1 
                            break

                        elif a[i+1][j+1] == 1:
                            print "F" 
                            f = 1 
                            break

                        else:
                            print "D" 
                            f = 1 
                            break

    except EOFError:
        break
~

Submission status: Runtime Error

Solution code:
while True:
    try:

        a = [[0 for j in range(8)]for i in range(8)]

        for i in range(8):
            a[i] = list(map(int,raw_input()))

        f = 0 

        i = 0 
        j = 0                                                                                                                                                                                                                                                                                                                  

        for i in range(8):

            if f == 1:
                f = 0 
                break

            for j in range(8):
                if a[i][j] == 1:
                    if a[i][j+1] == 1:

                        if a[i][j+2] == 1:
                            print "C" 
                            f = 1 
                            break

                        elif a[i+1][j] == 1:

                            if a[i+1][j+1] == 1:
                                print "A" 
                                f = 1 
                                break
                            if a[i+1][j-1] == 1:
                                print "G" 
                                f = 1 
                                break

                        else:
                            print "E" 
                            f = 1 
                            break

                    elif a[i+1][j] == 1:

                        if a[i+2][j] == 1:
                            print "B" 
                            f = 1 
                            break

                        elif a[i+1][j+1] == 1:
                            print "F" 
                            f = 1 
                            break

                        else:
                            print "D" 
                            f = 1 
                            break

    except EOFError:
        break

Submission status: Runtime Error

Solution code:
while True:
    try:

        a = [[0 for j in range(8)]for i in range(8)]
        for i in range(8):
            a[i] = list(map(int,raw_input()))

        f = 0 
        for i in range(8):                                                                                                                                                                                                                                                                                                     

            if f == 1:
                f = 0 
                break

            for j in range(8):

                if a[i][j] == 1:

                    if a[i][j+1] == 1:

                        if a[i][j+2] == 1:
                            print "C" 
                            f = 1 
                            break

                        elif a[i+1][j] == 1:

                            if a[i+1][j+1] == 1:
                                print "A" 
                                f = 1 
                                break
#                            if a[i+1][j-1] == 1:
#                                print "G"
#                                f = 1
#                                break
                            else:
                                print "G" 
                                f = 1 
                                break

                        else:
                            print "E" 
                            f = 1 
                            break

                    elif a[i+1][j] == 1:

                        if a[i+2][j] == 1:
                            print "B" 
                            f = 1 
                            break

                        elif a[i+1][j+1] == 1:
                            print "F" 
                            f = 1 
                            break

                        else:
                            print "D" 
                            f = 1 
                            break

    except EOFError:
        break

Submission status: Runtime Error

Solution code:
while True:
    try:

        a = [[0 for k in range(8)]for m in range(8)]
        for i in range(8):                                                                                                                                                                                                                                                                                                     
            a[i] = list(map(int,raw_input()))

        f = 0 
        for i in range(8):

            if f == 1:
                f = 0 
                break

            for j in range(8):

                if a[i][j] == 1:

                    if a[i][j+1] == 1:

                        if a[i][j+2] == 1:
                            print "C" 
                            f = 1 
                            break

                        elif a[i+1][j] == 1:

                            if a[i+1][j+1] == 1:
                                print "A" 
                                f = 1 
                                break
#                            if a[i+1][j-1] == 1:
#                                print "G"
#                                f = 1
#                                break
                            else:
                                print "G" 
                                f = 1 
                                break

                        else:
                            print "E" 
                            f = 1 
                            break

                    elif a[i+1][j] == 1:

                        if a[i+2][j] == 1:
                            print "B" 
                            f = 1 
                            break

                        elif a[i+1][j+1] == 1:
                            print "F" 
                            f = 1 
                            break

                        else:
                            print "D" 
                            f = 1 
                            break

    except EOFError:
        break

Submission status: Runtime Error

Solution code:
# -*- coding: utf8 -*-

import sys


types = ['A', 'B', 'C', 'D', 'E', 'F', 'G']


def main():
    while True:
        try:
            data = []
            for i in xrange(8):
                data.append(raw_input())

            check_figure(data)

            # 空行
            raw_input()
        except EOFError:
            break


def check_figure(data):
    # 最初の1を探す
    for i in xrange(8):
        for j in xrange(8):
            if data[i][j] == "1":
                for t in types:
                    if check_pattern(data, pattern(t, i, j)):
                        print t
                        return
                return


def pattern(p, i, j):
    if p == 'A':
        return [(i, j), (i, j + 1), (i + 1,  j), (i + 1, j + 1)]
    elif p == 'B':
        return [(i, j), (i + 1, j), (i + 2, j), (i + 3, j)]
    elif p == 'C':
        return [(i, j), (i, j + 1), (i, j + 2), (i, j + 3)]
    elif p == 'D':
        return [(i, j), (i + 1, j - 1), (i + 1, j), (i + 2, j - 1)]
    elif p == 'E':
        return [(i, j), (i, j + 1), (i + 1, j + 1), (i + 1, j + 2)]
    elif p == 'F':
        return [(i, j), (i + 1, j), (i + 1, j + 1), (i + 2, j + 1)]
    elif p == 'G':
        return [(i, j), (i, j + 1), (i + 1, j - 1), (i + 1, j)]
    else:
        return None


def check_pattern(data, block):
    for p in block:
        oob = is_out_of_bounds(p[0], p[1])
        empty = (data[p[0]][p[1]] == '0')

        if oob or empty:
            return False

    return True


def is_out_of_bounds(x, y):
    if x < 0 or x >= 8 or y < 0 or y >= 8:
        return True
    else:
        return False


main()

Submission status: Runtime Error

Solution code:
while True:
    try:
	h = 0
	for i in range(10):
            tmp = raw_input()
            if sum(int(tmp)) != 0:
                a[h] = tmp
		h += 1
      	if h == 4:
	    print "B"
	elif h == 1:
	    print "C"
	elif h == 2:
            c = int(a[0])/int(a[1])
            if c == 1:
            	print "A"
	    elif c == 10:
		print "E"
	    elif c == 0:
            	print "G"
	else:
	    c = int(a[0])/int(a[2])
	    if c ==	10:
            	print "F"
	    else:
            	print "D"

Submission status: Runtime Error

Solution code:
while True:
    try:
	h = 0
	for i in range(8):
            tmp = raw_input()
            if int(tmp) != 0:
                a[h] = tmp
		h += 1
      	if h == 4:
	    print "B"
	elif h == 1:
	    print "C"
	elif h == 2:
            c = int(a[0])/int(a[1])
            if c == 1:
            	print "A"
	    elif c == 10:
		print "E"
	    elif c == 0:
            	print "G"
	else:
	    c = int(a[0])/int(a[2])
	    if c ==	10:
            	print "F"
	    else:
            	print "D"

Submission status: Runtime Error

Solution code:
while True:
    try:
        h = 0
        for i in range(8):
            tmp = raw_input()
            if tmp.count(1) = 0:
                a[h] = tmp
                h += 1
        if h == 1:
            print "C"
        elif h == 2:
            c = a[0].index(1) - a[1].index(1)
            if c == 0:
                print "A"
            elif c == -1:
                print "E"
            else:
                print "G"
        elif h == 3:
            c = a[0].index(1) - a[2].index(1)
            print "D" if c == 1 else "F"
        else:
            print "B"

    except:
        break

Submission status: Runtime Error

Solution code:
while True:
    try:
        h = 0
        for i in range(8):
            tmp = raw_input()
            if int(tmp) = 0:
                a[h] = tmp
                h += 1
        if h == 1:
            print "C"
        elif h == 2:
            c = a[0].index(1) - a[1].index(1)
            if c == 0:
                print "A"
            elif c == -1:
                print "E"
            else:
                print "G"
        elif h == 3:
            c = a[0].index(1) - a[2].index(1)
            print "D" if c == 1 else "F"
        else:
            print "B"

    except:
        break

Submission status: Runtime Error

Solution code:
while True:
    try:
        h = 0
        for i in range(8):
            tmp = raw_input()
            if int(tmp) = 0:
                a[h] = tmp
                h += 1
        if h == 1:
            print "C"
        elif h == 2:
            c = a[0].index("1") - a[1].index("1")
            if c == 0:
                print "A"
            elif c == -1:
                print "E"
            else:
                print "G"
        elif h == 3:
            c = a[0].index("1") - a[2].index("1")
            print "D" if c == 1 else "F"
        else:
            print "B"

    except:
        break

Submission status: Runtime Error

Solution code:
while True:
    try:
        h = 0
        a=["","","",""]
        for i in range(8):
            tmp = raw_input()
            if int(tmp) != 0:
            a[h] = tmp
            h += 1
    	if h == 1:
            print "C"
        elif h == 2:
            c = a[0].index("1") - a[1].index("1")
            if c == 0:
                print "A"
            elif c == -1:
                print "E"
            else:
                print "G"
        elif h == 3:
            c = a[0].index("1") - a[2].index("1")
            print "D" if c == 1 else "F"
        else:
            print "B"
    	raw_input()
    except:
	break

Submission status: Runtime Error

Solution code:
import sys
N = 8
ptn = [18,48,6,30,20,34,16]
def f(D):
    i = 0
    s = 0
    D = D[D.index("1"):]
    for c in D:
        if c=="1": s += i
        i += 1
    p = "ABCDEF"[ptn.index(s)]
    return p
 
i=0
D=""
for s in sys.stdin:
    if i<8:
        D+=s[1:]
        i+=1
    else:
        print f(D)
        D=""
        i=0
print f(D)

Submission status: Runtime Error

Solution code:
import sys
N = 8
ptn = [18,48,6,30,20,34,16]
def f(D):
    i = 0
    s = 0
    D = D[D.index("1"):]
    for c in D:
        if c=="1": s += i
        i += 1
    p = "ABCDEF"[ptn.index(s)]
    return p
 
i=0
D=""
for s in sys.stdin:
    if i<8:
        D+=s[:-1]
        i+=1
    else:
        print f(D)
        i=0
        D=""
print f(D)

Submission status: Runtime Error

Solution code:
import sys
N = 8
ptn = [18,48,6,30,20,34,16]
def f(D):
    i = 0
    s = 0
    D = D[D.index("1"):]
    for c in D:
        if c=="1": s += i
        i += 1
    p = "ABCDEF"[ptn.index(s)]
    return p
 
i=0
D=""
for s in sys.stdin:
    if i<8:
        D+=s[:-1]
        i+=1
    else:
        print f(D)
        i=0
        D=""
if D!="": print f(D)

Submission status: Runtime Error

Solution code:
import sys
ptn = [18,48,6,30,20,34,16]

def f(D):
    i = 0
    s = 0
    D = D[D.index("1"):]
    for c in D:
        if c=="1": s += i
        i += 1
    p = "ABCDEF"[ptn.index(s)]
    return p
 
i=0
D=""
for s in sys.stdin:
    i+=1
    D+=s[:-1]
    if i==8:
        print f(D)
        i=0
        D=""

Submission status: Runtime Error

Solution code:
def f(D):
    i = 0
    s = 0
    D = D[D.index("1"):]
    for c in D:
        if c=="1": s += i
        i += 1
    p = "ABCDEF"[ptn.index(s)]
    return p
 
i=0
D=""
for s in sys.stdin:
    if i<8:
        i+=1
        D+=s[:-1]
    else:
        print f(D)
        i=0
        D=""
print f(D)

Submission status: Runtime Error

Solution code:
def f(D):
    i = 0
    s = 0
    D = D[D.index("1"):]
    for c in D:
        if c=="1": s += i
        i += 1
    p = "ABCDEFG"[ptn.index(s)]
    return p
 
i=0
D=""
for s in sys.stdin:
    if i<8:
        i+=1
        D+=s[:-1]
    else:
        print f(D)
        i=0
        D=""
print f(D)