fork download
  1. def nxtpalindrome(n):
  2. j=i=n
  3. a=1
  4. while (1):
  5. while (a!=0):
  6. b=i%10
  7. a=a+b*10
  8. i=i/10
  9. if(a==j):
  10. return j
  11. j+=1
  12. i=j
  13.  
  14. a=[]
  15. n=int(raw_input())
  16. i=0
  17. while(i<n):
  18. a.append(int(raw_input()))
  19. b=nxtpalindrome(a[i])
  20. print b
  21. i+=1
Runtime error #stdin #stdout #stderr 0.01s 8968KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 15, in <module>
EOFError: EOF when reading a line