A pair of two very large positive integers is given. Find their sum.
 
Example 1:
Input: s1 = "63457", s2 = "645"
Output: 64102
Explanation: 63457 + 645 = 64102
Example 2:
Input: s1 = "101", s2 = "102"
Output: 203
Explanation: 101 + 102 = 203
 
Your Task:
You don't need to read or print anything. Your task to complete the function add() which takes two numbers in string format as input parameter and returns their sum in string format.
 
Expected Time Complexity: O(max(len(s1), len(s2))
Expected Space Complexity: O(1)
 
Constraints:
1 <= |s1|, |s2| <= 100000

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(max(len(s1), len(s2))
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

	def add(self, s1, s2):

		# Code here

Solutions:
class Solution:

	def add(self, s1, s2):
		return int(s1) + int(s2)


class Solution:

	def add(self, s1, s2):
		a = int(s1)
		b = int(s2)
		return str(a + b)


class Solution:

	def add(self, s1, s2):
		a = int(s1)
		b = int(s2)
		c = a + b
		return c


class Solution:

	def add(self, s1, s2):
		c = int(s1)
		d = int(s2)
		return c + d


import math

class Solution:

	def add(self, s1, s2):
		return int(s1) + int(s2)


class Solution:

	def add(self, s1, s2):
		s1 = int(s1)
		s2 = int(s2)
		s = s1 + s2
		return str(s)


class Solution:

	def add(self, s1, s2):
		i1 = int(s1)
		i2 = int(s2)
		return i1 + i2


class Solution:

	def add(self, s1, s2):
		k = int(s1)
		j = int(s2)
		return k + j


class Solution:

	def add(self, s1, s2):
		x1 = int(s1)
		x2 = int(s2)
		sumx = x1 + x2
		return str(sumx)


class Solution:

	def add(self, s1, s2):
		n = len(s1)
		m = len(s2)
		if n > m:
			big = s1
			small = s2
			biglength = n
			smalllength = m
		else:
			big = s2
			small = s1
			biglength = m
			smalllength = n
		i = biglength - 1
		j = smalllength - 1
		c = 0
		ans = ''
		while j >= 0:
			temp = c + int(big[i]) + int(small[j])
			if temp > 9:
				c = 1
				temp = temp % 10
			else:
				c = 0
			ans = ans + str(temp)
			j = j - 1
			i = i - 1
		while i >= 0:
			temp = c + int(big[i])
			if temp > 9:
				c = 1
				temp = temp % 10
			else:
				c = 0
			ans = ans + str(temp)
			i = i - 1
		if c != 0:
			ans = ans + str(c)
		ans = ans[::-1]
		return ans


class Solution:

	def add(self, s1, s2):
		s1 = int(s1)
		s2 = int(s2)
		return s1 + s2
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		s1 = input()
		s2 = input()
		ob = Solution()
		ans = ob.add(s1, s2)
		print(ans)


class Solution:

	def add(self, s1, s2):
		n = len(s1)
		m = len(s2)
		extra = 0
		res = ''
		for i in range(m):
			if i == n:
				break
			x1 = s1[n - i - 1]
			x2 = s2[m - i - 1]
			sum_val = str(int(x1) + int(x2) + extra)
			if len(sum_val) == 2:
				extra = 1
			else:
				extra = 0
			res = sum_val[-1] + res
		if n > m:
			x = n
			i += 1
			str_x = s1
		elif n < m:
			x = m
			str_x = s2
		else:
			x = False
		if x != False:
			for k in range(x - i):
				sum_val = str(int(str_x[x - k - i - 1]) + extra)
				if len(sum_val) == 2:
					extra = 1
				else:
					extra = 0
				res = sum_val[-1] + res
		if extra == 1:
			res = str(extra) + res
		return res
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		s1 = input()
		s2 = input()
		ob = Solution()
		ans = ob.add(s1, s2)
		print(ans)


def add_decimal_nums(x, y):
	result = ''
	carry = 0
	i = len(x) - 1
	j = len(y) - 1
	while i >= 0 or j >= 0:
		r = 0
		r += int(x[i]) if i >= 0 else 0
		r += int(y[j]) if j >= 0 else 0
		r += carry
		result = str(r % 10) + result
		carry = r // 10
		i -= 1
		j -= 1
	if carry > 0:
		result = str(carry) + result
	return int(result)

class Solution:

	def add(self, s1, s2):
		return add_decimal_nums(s1, s2)
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		s1 = input()
		s2 = input()
		ob = Solution()
		ans = ob.add(s1, s2)
		print(ans)


class Solution:

	def add(self, s1, s2):
		i = len(s1) - 1
		j = len(s2) - 1
		carry = 0
		str3 = ''
		while i >= 0 and j >= 0:
			sum1 = int(s1[i]) + int(s2[j]) + carry
			str3 = str(sum1 % 10) + str3
			carry = sum1 // 10
			i -= 1
			j -= 1
		while i >= 0:
			sum1 = int(s1[i]) + carry
			str3 = str(sum1 % 10) + str3
			carry = sum1 // 10
			i -= 1
		while j >= 0:
			sum1 = int(s2[j]) + carry
			str3 = str(sum1 % 10) + str3
			carry = sum1 // 10
			j -= 1
		if carry:
			str3 = str(carry) + str3
		return str3


class Solution:

	def add(self, s1, s2):
		l1 = len(s1) - 1
		l2 = len(s2) - 1
		ans = 0
		(su, carry) = (0, 0)
		strg = ''
		while l1 >= 0 and l2 >= 0:
			a = int(s1[l1])
			b = int(s2[l2])
			su = a + b + carry
			if su > 9:
				carry = su // 10
				su = su % 10
				strg += str(su)
			else:
				carry = 0
				strg += str(su)
			l1 -= 1
			l2 -= 1
		while l1 >= 0:
			su = int(s1[l1]) + carry
			if su > 9:
				carry = su // 10
				su = su % 10
				strg += str(su)
			else:
				carry = 0
				strg += str(su)
			l1 -= 1
		while l2 >= 0:
			su = int(s2[l2]) + carry
			if su > 9:
				carry = su // 10
				su = su % 10
				strg += str(su)
			else:
				carry = 0
				strg += str(su)
			l2 -= 1
		if carry != 0:
			strg += str(carry)
		return strg[::-1]


class Solution:

	def add(self, s1, s2):
		str1 = s1
		str2 = s2
		if len(str1) > len(str2):
			temp = str1
			str1 = str2
			str2 = temp
		str3 = ''
		n1 = len(str1)
		n2 = len(str2)
		diff = n2 - n1
		carry = 0
		for i in range(n1 - 1, -1, -1):
			sum = ord(str1[i]) - ord('0') + int(ord(str2[i + diff]) - ord('0')) + carry
			str3 = str(sum % 10) + str3
			carry = sum // 10
		for i in range(n2 - n1 - 1, -1, -1):
			sum = ord(str2[i]) - ord('0') + carry
			str3 = str(sum % 10) + str3
			carry = sum // 10
		if carry:
			str3 = str(carry) + str3
		return str3


class Solution:

	def add(self, s1, s2):
		x = int(s1)
		y = int(s2)
		return x + y


class Solution:

	def add(self, s1, s2):
		l = len(s1) - 1
		m = len(s2) - 1
		r = ''
		return int(s1) + int(s2)


class Solution:

	def add(self, s1, s2):
		a1 = int(s1)
		a2 = int(s2)
		s = a1 + a2
		return s


class Solution:

	def add(self, s1, s2):
		p = int(s1)
		m = int(s2)
		return str(p + m)


class Solution:

	def add(self, s1, s2):
		s = int(s1)
		t = int(s2)
		return s + t


class Solution:

	def add(self, s1, s2):
		t = int(s1)
		t1 = int(s2)
		return t + t1


class Solution:

	def add(self, s1, s2):
		str1 = int(s1)
		str2 = int(s2)
		return str1 + str2


class Solution:

	def add(self, s1, s2):
		l1 = len(s1)
		l2 = len(s2)
		output = ''
		if l1 < l2:
			(s1, s2) = (s2, s1)
			(l1, l2) = (l2, l1)
		(i1, i2) = (1, 1)
		carry_over = 0
		while i2 <= l2:
			n1 = int(s1[-i1])
			n2 = int(s2[-i2])
			sum_ = carry_over + n1 + n2
			digit = sum_ % 10
			carry_over = int(sum_ / 10)
			output = str(digit) + output
			i1 += 1
			i2 += 1
		while i1 <= l1:
			sum_ = carry_over + int(s1[-i1])
			digit = sum_ % 10
			carry_over = int(sum_ / 10)
			output = str(digit) + output
			i1 += 1
		if carry_over > 0:
			output = str(carry_over) + output
		return output


class Solution:

	def add(self, str1, str2):
		(p1, p2) = (len(str1) - 1, len(str2) - 1)
		carry = 0
		result = ''
		while p1 >= 0 and p2 >= 0:
			s = int(str1[p1]) + int(str2[p2]) + carry
			if s >= 10:
				carry = 1
				s -= 10
			else:
				carry = 0
			result = str(s) + result
			p1 -= 1
			p2 -= 1
		while p1 >= 0:
			s = int(str1[p1]) + carry
			if s >= 10:
				carry = 1
				s -= 10
			else:
				carry = 0
			result = str(s) + result
			p1 -= 1
		while p2 >= 0:
			s = int(str2[p2]) + carry
			if s >= 10:
				carry = 1
				s -= 10
			else:
				carry = 0
			result = str(s) + result
			p2 -= 1
		if carry:
			result = '1' + result
		return result