Given an Integer N, write a program to reverse it.

-----Input-----

The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N. 

-----Output-----
For each test case, display the reverse of the given number N, in a new line.

-----Constraints-----
- 1 ≤ T ≤ 1000
- 1 ≤ N ≤ 1000000

-----Example-----
Input
4
12345
31203
2123
2300
Output
54321
30213
3212
32

Difficulty: EASY
Tags: Mathematics

Implementation

Complete search
Skill types: Complete search

Starter code:

Solutions:
n = int(input())
for i in range(n):
	k = int(input())
	while 1:
		if k % 10 == 0:
			k = int(k / 10)
		else:
			break
	k = str(k)
	print(k[::-1])


t = int(input())
for i in range(t):
	s = input()
	n = int(s[::-1])
	print(n)


for i in range(int(input())):
	n = int(input())
	rev_num = 0
	while n > 0:
		a = n % 10
		rev_num = rev_num * 10 + a
		n = n // 10
	print(rev_num)


N = int(input())
for i in range(N):
	x = input()
	print(int(x[::-1]))


n = int(input())
while n > 0:
	x = input()
	print(int(x[::-1]))
	n = n - 1


x = int(input())
for i in range(x):
	s = input()
	print(int(s[::-1]))


t = int(input())
for i in range(t):
	n = input()
	print(n[::-1].strip('0'))


t = int(input())
for i in range(t):
	n = int(input())
	r = 0
	while n > 0:
		p = n % 10
		r = r * 10 + p
		n //= 10
	print(r)


x = int(input())
for i in range(x):
	n = int(input())
	rev = 0
	while n > 0:
		d = n % 10
		rev = rev * 10 + d
		n = n // 10
	print(rev)


for _ in range(int(input())):
	n = input()
	a = n[::-1]
	k = 0
	for i in a:
		if i == '0':
			k += 1
		else:
			break
	print(a[k:])


for i in range(int(input())):
	n = int(input())
	reverse = 0
	while n:
		remainder = n % 10
		reverse = reverse * 10 + remainder
		n = int(n // 10)
	print(reverse)


x = int(input())
for i in range(x):
	y = input()
	print(y[::-1].lstrip('0'))


t = eval(input())
for i in range(t):
	n = eval(input())
	rev = 0
	while n > 0:
		rem = n % 10
		rev = rev * 10 + rem
		n = n // 10
	print(rev)


for I in range(int(input())):
	num = int(input())
	rev = 0
	while num != 0:
		rev = rev * 10 + num % 10
		num = num // 10
	print(rev)


t = int(input())
for i in range(0, t):
	a = int(input())
	b = str(a)
	c = b[::-1]
	d = int(c)
	print(d)


for _ in range(int(input())):
	N = int(input())
	Rev = 0
	while N > 0:
		Rev = Rev * 10 + N % 10
		N = N // 10
	print(Rev)


T = int(input())
for i in range(T):
	i = input()
	revi = i[::-1]
	print(int(revi))


n = int(input())
a = []
for i in range(0, n):
	no = int(input())
	a.append(no)
for i in range(0, n):
	c = 0
	s = 0
	while a[i] != 0:
		c = a[i] % 10
		s = s * 10 + c
		a[i] = a[i] // 10
	print(s)


T = int(input())
for i in range(0, T):
	x = input()
	x = x[::-1]
	print(int(x))


t = int(input())
for i in range(t):
	a = input()
	print(int(a[::-1]))


t = int(input())
for i in range(t):
	x = input()
	print(int(x[::-1]))


a = int(input(''))
l = []
for m in range(a):
	b = input('')
	l.append(b)
for m in range(a):
	n = list(l[m])
	n.reverse()
	s = ''
	for t in n:
		s = s + t
	w = int(s)
	print(w)


t = int(input())
while t > 0:
	n = int(input())
	tmp = int(n)
	r = 0
	while tmp > 0:
		d = int(tmp % 10)
		r = int(r * 10 + d)
		tmp = int(tmp / 10)
	print(r)
	t -= 1


n = int(input())
for i in range(n):
	x = int(input())
	re = 0
	while x > 0:
		r = x % 10
		re = re * 10 + r
		x = x // 10
	print('{}'.format(re))


t = int(input())
while t:
	t -= 1
	n = str(input())
	print(int(n[::-1]))


for _ in range(int(input())):
	s = int(input())
	rev = 0
	while s > 0:
		rev = rev * 10 + s % 10
		s = s // 10
	print(rev)


n = int(input())
for i in range(n):
	a = input()
	a = a[::-1]
	print(int(a))


T = int(input())
for i in range(T):
	N = input()
	N = N[None:None:-1]
	print(int(N))


arr = []
for a in range(int(input())):
	arr.append(int(''.join(reversed(input()))))
print(*arr, sep='\n')


t = int(input())
for i in range(t):
	reverse = 0
	num = int(input())
	while num:
		remainder = num % 10
		reverse = reverse * 10 + remainder
		num = int(num / 10)
	print(reverse)


t = int(input())
for i in range(t):
	n = int(input())
	a = int(str(n)[::-1])
	print(a)


t = int(input())
for i in range(t):
	n = int(input())
	temp = n
	rev = 0
	while temp > 0:
		a = temp % 10
		rev = rev * 10 + a
		temp = temp // 10
	print(rev)


for t in range(int(input())):
	num = int(input())
	reverse = int(str(num)[::-1])
	print(reverse)


s = int(input())
for j in range(s):
	reverse = 0
	num = int(input())
	while num:
		remainder = num % 10
		reverse = reverse * 10 + remainder
		num = int(num / 10)
	print(reverse)


t = int(input())
for i in range(t):
	s = input()
	l = list(s)
	i = 0
	j = len(l) - 1
	while i < j:
		(l[i], l[j]) = (l[j], l[i])
		i += 1
		j -= 1
	print(int(''.join(l)))


T = int(input())
for i in range(0, T):
	N = int(input())
	num = 0
	while N:
		mod = int(N % 10)
		num = int(num * 10 + mod)
		N = int(N / 10)
	print(num)