Exclusive Or

Find the XOR of two numbers and print it.

Hint: Input the numbers as strings.

Input Format

First-line contains the first number X and the second line contains second number Y.
The numbers will be given to you in binary form.

Constraints

0 <= X <= 2^1000
0 <= Y <= 2^1000

Output Format

Output one number in binary format, the XOR of two numbers.

Sample Input 0

11011
10101

Sample Output 0

01110

 

 

CODE:

a=input()

b=input()

c=""

 

if len(a)<=len(b):

    k=len(b)-len(a)

    l="0"*k

    a=l+a

else:

    k=len(a)-len(b)

    l="0"*k

    b=l+b

   

for i in range(len(a)):

    c+=str(int(a[i])^int(b[i]))

 

print(c)

Comments

Popular posts from this blog

Trouble with the Number System

Residue Arithmetic

Perfect Peak of Array