s = input()
c = 0
while True:
    res = s.replace("10", '')
    #print(res)
    diff = len(s) - len(res)
    if diff == 0:
        break
    #print(diff)
    c += diff
    s = res
while True:
    res = s.replace("01", '')
    #print(res)
    diff = len(s) - len(res)
    if diff == 0:
        break
    #print(diff)
    c += diff
    s = res

#print(s)
print(c)