Wednesday, May 23, 2018

ADDREV : Classical

#The Python 3 solution is as follows:

import sys
t = int(input())
i=0
while i<t:
    a,b = map(int,sys.stdin.readline().split())     #to take both inputs in single line
    c=str(a)                                                         #converting the number into string
    d=str(b)
    e=int(c[::-1])                                                #converting reverse of the string c to int
    f=int(d[::-1])                                               #converting reverse of the string d to int
    s=e+f                                                          #adding the two reverse numbers
    s1=str(s)
    s2=int(s1[::-1])                                           #reverse s and display it
    print(s2)                                                   
    i+=1


#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!