a = input()
b= []
c= []
for i in range(0, len(a)):
    if a[i]=="?":
        if i%2 == 0:
            a = a.replace("?", "1")
        else:
            a= a.replace("?", "0")
if a[i]== "1":
    b.append("1")
elif a[i]== "0":
    c.append("0")
print(abs(len(b)-len(c)))