class Solution(object):
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
m=len(a)
n=len(b)
maxlen=max(m,n)
result=""
carry=0
for i in range(maxlen):
x=int(a[m-1-i]) if i<m else 0
y=int(b[n-1-i]) if i<n else 0
sum=x+y+carry
result=str(sum%2)+result
carry=sum/2
if carry>0:
return "1"+result
else:
return result