Hello all,

Was just attempting this question for practice and have used Python3.  I am 
repetitively getting WA and I am not able to find any specific case that I 
might have missed.

Here's the code: 

T = int(input())
t = 1
cas = ["P","R","S"]
while(t <= T):
    res = ""
    A = int(input())
    l = []
    for i in range(A):
        l.append(input())
    pos = 0
    while(len(l) > 0):
#        print(l)
        al = []
        for i in l:
            if(i[pos%len(i)] not in al):
                al.append(i[pos%len(i)])
        if(len(al) == 1):
            res += cas[(cas.index(al[0])-1)%3]
            l.clear()
        elif(len(al) == 3):
            res = "IMPOSSIBLE"
            l.clear()
        else:
            al = sorted(al)
            if(al[1] == "S" and al[0] == "P"):
                res += "S"
            else:
                res += al[0]
            l = list(filter(lambda x: x[pos%len(x)] != al[1],l))
            pos += 1
    print("Case #{}: {}".format(t, res))
#    print("Case #",t,": ",res,sep="")
    t += 1

would be great if someone could help me out.

Thanks in advance! 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/11d66745-c963-4ded-b944-b1090ec53a61%40googlegroups.com.

Reply via email to