What's Wrong?

Whats’s wrong in my code:
showing --> run time error (NZEC)
my code link --> Solution: 40861192 | CodeChef
Question link–>Contest Page | CodeChef

The input is not following the constraints. So, what we can do is just strip() white space characters while reading input. It’s not your fault, it’s the fault of the person who generated Test data.
Here’s your AC code.

# cook your dish here
for _ in range(int(input())):
    x = input().strip()
    alpha = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
    #num = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,15]
    key = [98, 57, 31, 45, 46]
    ans = ""
    for i in range(len(x)):
        k = (((alpha.index(x[i])) + key[i]) % 26)
        #print (k)
        ans += alpha[k]
        #print (k)
    print (ans)

ohh thanks bro for help