rahul-hacker

Rahul Hacker has a message that he has coded in form of digits, which means that the message contains only numbers and nothing else. He is fearful that the enemy may get their hands on the secret message and may decode it. Rahul Hacker already knows the message by heart and he can simply destroy it.

But he wants to keep it in case its needed in a worse situation. He wants to further encode the message in such a format which is not completely reversible. This way if enemies gets hold of the message they will not be completely able to decode the message.

Since the message consists only of number he decides to flip the numbers. The first digit becomes last and vice versa. For example, if there is 3769 in the code, it becomes 9673 now. All the leading zeros are omitted e.g. 15900 gives 951. So this way the encoding can not completely be deciphered and has some loss of information.

Rahul Hacker is further thinking of complicating the process and he needs your help. He decides to add the two flipped numbers and print the result in the encoded (flipped) form. There is one problem in this method though. For example, 134 could be 431, 4310 or 43100 before reversing. Hence the method ensures that no zeros were lost, that is it can be assumed that the original number was 431.

INPUT

The input consists of T test cases. The first line of the input contains only positive integer T. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the flipped numbers you are to add.

OUTPUT

For each case, print exactly one line containing only one integer - the flipped sum of two flipped numbers.

CONSTRAINTS
The value of T will be less than 1000
The value of digits will be less than 500000

SAMPLE INPUT
2
353 575
238746 39857

SAMPLE OUTPUT
829
527327

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
def digit(num):

	no=list(map(str,str(num)))
	l=int(len(str(num)))/2
	for i in range(l):
	
		
	
		a=no[i]
		no[i]=no[-1-i]
		no[-1-i]=a
	z=int(''.join(no)) 

	
	return z
		
		
	
for k in range (eval(input())):
	x,y=list(map(int,input().split(" ")))
	s=int(digit(x))+int(digit(y))
	ans=digit(s)
	print(ans)


for _ in range(eval(input())):
	a,b=input().split(" ")
	a=a[::-1]
	b=b[::-1]
	c=int(a)+int(b)
	print(int(str(c)[::-1]))


t=eval(input())
while(t!=0):
	x,y=input().split()
	x=x[::-1]
	y=y[::-1]
	x=int(x)
	y=int(y)
	z=x+y
	z=str(z)
	z=z[::-1]
	z=int(z)
	print(z)
	t=t-1


from sys import stdin
t = stdin.readline()
a = stdin.readlines()
for i in a:
	x,y = i.split()
	x = str(int(x))
	y = str(int(y))
	x = list(x);y = list(y)
	x.reverse();y.reverse()
	z = str( int(''.join(x)) + int(''.join(y)))
	z = list(z)
	z.reverse()
	print(str(int(''.join(z))))


import sys
test=int(eval(input()))
while(test>0):
	a,b = list(map(int,sys.stdin.readline().split()))
	a1=str(a)[::-1]
#	print(a1)
	b1=str(b)[::-1]
	#print(b1)
	sum=int(a1)+int(b1)
	#print(sum)
	sum1=str(sum)[::-1]
	print((int(sum1)))
	test-=1


for _ in range(eval(input())):
	a,b=list(map(str,input().split()))
	x=a[::-1]
	y=b[::-1]
	t=int(x)+int(y)
	t=str(t)
	print(int(t[::-1]))