XJTU_Python/test/6/2.py

26 lines
531 B
Python

a = input()
b = input()
# ands = ""
# ors = ""
xors = ""
while (len(a) > len(b)):
b = "0" + b
while (len(a) < len(b)):
a = "0" + a
for i in range(len(a)):
if (a[i] == "0" and b[i] == "0"):
# ands += "0"
# ors += "0"
xors += "0"
if ((a[i] == "1" and b[i] == "0") or (a[i] == "0" and b[i] == "1")):
# ands += "0"
# ors += "1"
xors += "1"
if (a[i] == "1" and b[i] == "1"):
# ands += "1"
# ors += "1"
xors += "0"
print(a)
print(b)
print(xors)