You will be given two numbers a and b. Your task is to print 1 if a < b, print 2 if a > b and print 3 if a = b. 
Example 1:
Input: 
a = 1234
b = 12345
Output: 1
Explanation: a < b so answer is 1.
Example 2:
Input:
a = 100
b = 1
Output: 2
Explanation: a > b, so answer is 2.
User Task:
Your task is to complete the function check() which takes 2 arguments(string a, string b) and returns the answer. You need not take input or print anything.
Expected Time Complexity: O(|a| + |b|).
Expected Auxiliary Space: O(|a| - |b|).
Constraints:
1 ≤ |a|, |b| ≤ 155^{       }
'0' ≤  a_{i},b_{i } ≤  '9'

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3



class Solution:



    def check(self, a,b):

        # code here

Solutions:
class Solution:

	def check(self, a, b):
		if a < b:
			return 1
		elif b < a:
			return 2
		else:
			return 3


class Solution:

	def check(self, a, b):
		A = int(a)
		B = int(b)
		if A < B:
			return 1
		if A > B:
			return 2
		return 3


class Solution:

	def check(self, a, b):
		c = int(a)
		d = int(b)
		if c > d:
			return 2
		elif d > c:
			return 1
		else:
			return 3


class Solution:

	def check(self, a, b):
		x = int(a)
		y = int(b)
		if x == y:
			return 3
		if x > y:
			return 2
		if x < y:
			return 1


class Solution:

	def check(self, a, b):
		num_a = int(a)
		num_b = int(b)
		return 1 if num_a < num_b else 2 if num_b < num_a else 3


class Solution:

	def check(self, a, b):
		n = int(a)
		n1 = int(b)
		if n < n1:
			return 1
		elif n > n1:
			return 2
		return 3


class Solution:

	def check(self, a, b):
		a1 = int(a)
		b1 = int(b)
		if a1 < b1:
			return 1
		elif a1 > b1:
			return 2
		else:
			return 3


class Solution:

	def check(self, a, b):
		(int1, int2) = (int(a), int(b))
		if a < b:
			return 1
		elif a > b:
			return 2
		else:
			return 3


class Solution:

	def check(self, a, b):
		an = int(a)
		ab = int(b)
		if an < ab:
			return 1
		elif an > ab:
			return 2
		else:
			return 3