[MISSION LEVEL:C]-Python 3

478 ワード

答え
# coding: utf-8
#   の  な  で
# Let's チャレンジ!!

N=input()
w_a=0
w_b=0
gpc_dict={
    "gg":0,"cc":0,"pp":0,"gc":1,
    "cp":1,"cg":-1,"pc":-1,
    "pg":1,"gp":-1,
}

for i in range(int(N)):
    ab=input()
    new_ab=ab.replace(" ","")
    who_win=gpc_dict.get(new_ab)
    if who_win>0:
        w_a+=1
    elif who_win<0:
        w_b+=1
print(w_a)
print(w_b)