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: Wrong Answer

Solution code:
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 = []

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 iter_input_lines():
    try:
        while True:
            yield [list(input()) for _ in range(8)]
    except EOFError:
        return StopIteration


def f1():
    for lines in iter_input_lines():
        f2(lines)


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


def f3(lines, figure):
    height = len(figure)
    width = len(figure[0])
    for h in range(0, 8, height):
        for w in range(0, 8, width):
            found = f4(lines, figure, height, width, h, w)
            if found:
                return True
        
        
def f4(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

Submission status: Wrong Answer

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:
        break

Submission status: Wrong Answer

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 == p[3]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        judge()
    except:
        break

Submission status: Wrong Answer

Solution code:
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:
        print('error')
        break

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
while True : 
    try :
        switch = 0
        for _ in range(9) :
            if switch == 0 :
                temp = input()
                if temp == '00000000' or temp == '' : pass
                else :
                    onetwo, place = 0, 0
                    if '1111' in temp :
                        print('C')
                        switch = 1
                    else : onetwo, place = temp.count('1'), temp.index('1')

                    temp = input()
                    if onetwo == 1 :
                        if temp.count('1') == 1 : print('B')
                        elif temp.index('1') == place : print('F')
                        else : print('D')
                    elif onetwo == 2 :
                        if temp.index('1') == place : print('A')
                        elif temp.index('1') == place + 1 : print('E')
                        else : print('G')
                    switch = 1
            else : input()
    except : break

Submission status: Wrong Answer

Solution code:
while True : 
    try :
        temp = input()
        if temp == '00000000' or temp == '' : pass
        else :
            if '1111' in temp : print('C')
            else : 
                onetwo, place = temp.count('1'), temp.index('1')
                temp = input()
                if onetwo == 1 :
                    if temp.count('1') == 1 :
                        print('B')
                        input(),input()
                    elif temp.index('1') == place : print('F')
                    else : print('D')
                elif onetwo == 2 :
                    if temp.index('1') == place : print('A')
                    elif temp.index('1') == place + 1 : print('E')
                    else : print('G')
    except : break

Submission status: Wrong Answer

Solution code:
Figures = {"A": [[0, 1], [1, 0], [1, 1]],
           "B": [[1, 0], [2, 0], [3, 0]],
           "C": [[0, 1], [0, 2], [0, 3]],
           "D": [[1, -1], [1, 0], [2, -1]],
           "E": [[0, 1], [1, 1], [1, 2]],
           "F": [[1, 0], [1, 1], [2, 1]],
           "G": [[1, 0], [1, -1], [1, 0]]}
while True:
    try:
        k = [map(int, list(input())) for i in range(8)]
        l = [[y, x] for y,q in enumerate(k) for x,t in enumerate(q) if t]
        a, b = l[0]
        for i in range(4):
            l[i][0] -= a
            l[i][1] -= b
        for k, v in Figures.items():
            if l[1:] == v:
                print(k)
                break
        input()
    except:
        break

Submission status: Wrong Answer

Solution code:
import sys
line=[]
in_line=sys.stdin
for _in in in_line:line.append(_in)
#for i in range(26):line.append(input())
sets=(len(line)+1)//9
for i in range(sets):
    flag=0
    topindex=-1
    for j in range(i*9,i*9+8):
        a=line[j].count('1')
        if a!=0:t=line[j].index('1')
        else:t=-1
        if a==4:
            print('C')
            break
        elif flag==0 and a!=0:
            topindex=t
            if a==1:flag=1
            elif a==2:flag=2
        elif flag==1:
            if a==1:
                print('B')
                break
            elif a==2:
                if topindex==t:
                    print('F')
                    break
                else:
                    print('D')
                    break
        elif flag==2:
            if topindex==t:
                print('A')
                break
            elif topindex<t:
                print('E')
                break
            else:
                print('G')

Submission status: Wrong Answer

Solution code:
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('F')
        except EOFError:
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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 cnt == 4:
                print("C")
                cnt = -1
            elif "1" in inp:
                ind = inp.index("1")
                cnt = inp.count("1")
        inp = input()
    except:
        break

Submission status: Wrong Answer

Solution code:
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 cnt == 4:
                print("C")
                cnt = -1
            elif "1" in inp and cnt == 0:
                ind = inp.index("1")
                cnt = inp.count("1")
        inp = input()
    except:
        break

Submission status: Wrong Answer

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
		input()
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while True:
    lst = []
    try:
        for i in range(8):
            lst += list(map(int, input().split()))

        cnt = 0
        for i in range(len(lst)):
            if lst[i]:
                cnt += i
        cnt -= lst.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)
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        lst = []

        for i in range(8):
            lst += list(map(int, input()))

        cnt = 0
        for i in range(len(lst)):
            if lst[i]:
                cnt += i
        cnt -= lst.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)
    except:
        break

Submission status: Wrong Answer

Solution code:
ans = {"1100000011": "A", "1000000010000000100000001": "B",
       "1111": "C", "1000000110000001": "D",
       "11000000011": "E", "100000001100000001": "F", "0110000011": "G"}
while True:
    try:
        st = ""

        for i in range(8):
            st += input()

        for k, v in ans.items():
            if st.find(k) != -1:
                print(v)
                break
    except:
        break

Submission status: Wrong Answer

Solution code:
ans = {"1100000011": "A", "1000000010000000100000001": "B",
       "1111": "C", "1000000110000001": "D",
       "11000000011": "E", "100000001100000001": "F", "0110000011": "G"}
while True:
    try:
        st = "".join([input() for _ in range(8)])

        st = st[st.find("1"): st.rfind("1")+1]
        for k, v in ans.items():
            if st == k:
                print(v)
                break
        input()
    except:
        break

Submission status: Wrong Answer

Solution code:
inputs = int(input())
for i in range(inputs):
  s = i
 
#for i range 8:
    

print (s)

Submission status: Wrong Answer

Solution code:

Submission status: Wrong Answer

Solution code:
# -*- 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))

Submission status: Wrong Answer

Solution code:
#"1"の座標を、最初のものを(0,0)として切り出し
def trim(mp):
  ret = []

  for x in range(8):
    for y in range(8):
      if mp[y][x] == "1":
        if not ret:
          refer = (x, y)
        ret.append((x, y))

  ret = [(x - refer[0], y - refer[1]) for x, y in ret]
  return ret

#座標が一致したものを出力
def put_ans(points):
  if points == [(0, 0), (0, 1), (1, 0), (1, 1)]: print("A")
  if points == [(0, 0), (0, 1), (0, 2), (0, 3)]: print("B")
  if points == [(0, 0), (1, 0), (2, 0), (3, 0)]: print("C")
  if points == [(0, 0), (0, 1), (1, 0), (1, -1)]: print("D")
  if points == [(0, 0), (1, 0), (1, 1), (2, 1)]: print("E")
  if points == [(0, 0), (0, 1), (1, 1), (1, 2)]: print("F")
  if points == [(0, 0), (1, -1), (1, 0), (2, -1)]: print("G")

while True:
  mp = [input() for _ in range(8)]
  put_ans(trim(mp))
  try:
    input()
  except EOFError:
    break

Submission status: Wrong Answer

Solution code:
import sys
#l=[t for t in sys.stdin]

while 1:
    e=[sys.stdin.readline() for _ in range(8)]
    l=[l.find("1") for l in e if l.find("1")!=-1]
    if not l:break
    if len(l)==1:print("C")
    elif len(l)==2:
        if l[0]==l[1]:print("A")
        elif l[0]<l[1]:print("E")
        elif l[0]>l[1]:print("G")
    elif len(l)==3:
        if l[0]>l[1]:print("D")
        elif l[0]<l[1]:print("F")
    else: print("B")
    if sys.stdin.readline() == "":break

Submission status: Wrong Answer

Solution code:
A="".join(["11000000",
           "11000000"])

B="".join(["10000000",
           "10000000",
           "10000000",
           "10000000"])

C="".join(["11110000"])

D="".join(["01000000",
           "11000000",
           "10000000"])

E="".join(["11000000",
           "01100000"])

F="".join(["10000000",
           "11000000",
           "01000000"])

G="".join(["01100000",
           "11000000"])

teto=[A,B,C,D,E,F,G]

while True:
    try:
        a="".join([raw_input() for i in xrange(8)])
        for i in range(len(teto)):
            if a.find(teto[i])>0:
                print chr(i+ord("A"))
        raw_input()
    except:
        break
#temp

Submission status: Wrong Answer

Solution code:
A="".join(["11000000",
           "11"])

B="".join(["10000000",
           "10000000",
           "10000000",
           "1"])

C="".join(["11110000"])

D="".join(["01000000",
           "11000000",
           "1"])

E="".join(["11000000",
           "011"])

F="".join(["10000000",
           "11000000",
           "01"])

G="".join(["01100000",
           "11"])

teto=[A,B,C,D,E,F,G]

while True:
    try:
        a="".join([raw_input() for i in xrange(8)])
        for i in range(len(teto)):
            if a.find(teto[i])>0:
                print chr(i+ord("A"))
        raw_input()
    except:
        break

Submission status: Wrong Answer

Solution code:
A="".join(["11000000",
           "11"])

B="".join(["10000000",
           "10000000",
           "10000000",
           "1"])

C="".join(["11110000"])

D="".join(["01000000",
           "11000000",
           "1"])

E="".join(["11000000",
           "011"])

F="".join(["10000000",
           "11000000",
           "01"])

G="".join(["01100000",
           "11"])

teto=[A,B,C,D,E,F,G]

while True:
    try:
        a="".join([raw_input() for i in xrange(8)])
        for i in range(len(teto)):
            if a.find(teto[i])>=0:
                print chr(i+ord("A"))
        raw_input()
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = []
		for val in xrange(8):
			mass = raw_input(); line = [x for x in mass]
			lines.append(line)
		for p in xrange(8):
			zero = 0
			for q in xrange(8):
				if lines[q][7-p] == '0': zero += 1
			if zero == 8:
				for val in xrange(8): del lines[val][7-p]
		for val in xrange(8):
			if lines[7-val].count('0') == len(lines[7-val]): del lines[7-val]
		if   lines == [['1','1'],['1','1']]: print 'A'
		elif lines == [['1'],['1'],['1'],['1']]: print 'B'
		elif lines == [['1','1','1','1']]: print 'C'
		elif lines == [['0','1'],['1','1'],['1','0']]: print 'D'
		elif lines == [['1','1','0'],['0','1','1']]: print 'E'
		elif lines == [['1','0'],['1','1'],['0','1']]: print 'F'
		elif lines == [['0','1','1'],['1','1','10']]: print 'G'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = []
		for val in xrange(8):
			mass = raw_input(); line = [x for x in mass]
			lines.append(line)
		for p in xrange(8):
			zero = 0
			for q in xrange(8):
				if lines[q][7-p] == '0': zero += 1
			if zero == 8:
				for val in xrange(8): del lines[val][7-p]
		for val in xrange(8):
			if lines[7-val].count('0') == len(lines[7-val]): del lines[7-val]
		if   lines == [['1','1'],['1','1']]: print 'A'
		elif lines == [['1'],['1'],['1'],['1']]: print 'B'
		elif lines == [['1','1','1','1']]: print 'C'
		elif lines == [['0','1'],['1','1'],['1','0']]: print 'D'
		elif lines == [['1','1','0'],['0','1','1']]: print 'E'
		elif lines == [['1','0'],['1','1'],['0','1']]: print 'F'
		elif lines == [['0','1','1'],['1','1','0']]: print 'G'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = ''
		lines += raw_input()
		lines += raw_input()
		lines += raw_input()
		lines += raw_input()
		lines += raw_input()
		lines += raw_input()
		lines += raw_input()
		lines += raw_input()
		if   '1100000011' in lines: print 'A'
		elif '1000000010000000100000001' in lines: print 'B'
		elif '1111' in lines: print 'C'
		elif '1000000110000001' in lines: print 'D'
		elif '11000000011' in lines: print 'E'
		elif '100000001100000001' in lines: print 'F'
		elif '110000011' in lines: print 'G'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = ''
		for val in xrange(8): lines += str(input())
		if   '1100000011' in lines: print 'A'
		elif '1000000010000000100000001' in lines: print 'B'
		elif '1111' in lines: print 'C'
		elif '1000000110000001' in lines: print 'D'
		elif '11000000011' in lines: print 'E'
		elif '100000001100000001' in lines: print 'F'
		elif '110000011' in lines: print 'G'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = str(input())
		for val in xrange(7): lines += raw_input()
		print lines
		if   '1100000011' in lines: print 'A'
		elif '1000000010000000100000001' in lines: print 'B'
		elif '1111' in lines: print 'C'
		elif '1000000110000001' in lines: print 'D'
		elif '11000000011' in lines: print 'E'
		elif '100000001100000001' in lines: print 'F'
		elif '110000011' in lines: print 'G'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = str(input())
		for val in xrange(7): lines += raw_input()
		if   '1100000011' in lines: print 'A'
		elif '1000000010000000100000001' in lines: print 'B'
		elif '1111' in lines: print 'C'
		elif '1000000110000001' in lines: print 'D'
		elif '11000000011' in lines: print 'E'
		elif '100000001100000001' in lines: print 'F'
		elif '110000011' in lines: print 'G'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = '' ; lines += str(input())
		for val in xrange(7): lines += raw_input()
		if   '1100000011' in lines: print 'A'
		elif '1000000010000000100000001' in lines: print 'B'
		elif '1111' in lines: print 'C'
		elif '1000000110000001' in lines: print 'D'
		elif '11000000011' in lines: print 'E'
		elif '100000001100000001' in lines: print 'F'
		elif '110000011' in lines: print 'G'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
	try:
		lines = str(input())
		for val in xrange(7): lines += raw_input()
		if   '1100000011' in lines: print 'A'
		elif '1000000010000000100000001' in lines: print 'B'
		elif '1111' in lines: print 'C'
		elif '1000000110000001' in lines: print 'D'
		elif '11000000011' in lines: print 'E'
		elif '100000001100000001' in lines: print 'F'
		elif '110000011' in lines: print 'G'
		else: break
		lines = '0'
	except: break

Submission status: Wrong Answer

Solution code:
while True:
    L=[[0]+map(int,raw_input())+[0] for i in range(8)]
    L.append([0]*10)
    flag=True
    for i in range(8):
        for j in range(8):
            if L[i][j]==1:
                if L[i][j+1]==1:
                    if L[i+1][j]==1:#AG
                        if L[i+1][j+1]==1:
                            print "A"
                        else:
                            print "G"
                    else:
                        if L[i+1][j+1]==1:
                            print "E"
                        else:
                            print "C"
                else:#BDF
                    if L[i+2][j]==1:
                        print "B"
                    elif L[i+1][j+1]==1:
                        print "F"
                    else:
                        print "D"
                flag=False
                break
        if flag==False:
            break
    try:
        skip=raw_input()
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
while True:
    L=[]
    for i in range(8):
        s=raw_input()
        if "1" in s:
            L.append("0"+s+"0")
    if len(L)==4:
        print "B"
    elif len(L)==3:
        x=L[0].index("1")
        print "F" if L[1][x+1]=="1" else "D"
    elif len(L)==2:
        x=L[0].index("1")
        if L[1][x+1]:
            print "A" if L[1][x]=="1" else "E"
        else:
            print "G"
    else:
        print "C"
    try:
        skip=raw_input()
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import sys;import re
for s in sys.stdin.read().split('\n\n'):print 'BCD F GAE'[len(re.findall('1.*1',s.replace('\n',''))[0])%12-3]

Submission status: Wrong Answer

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"
    except:
	break