import sys

s = str(sys.stdin.readline())
o = len(s)
for i in range(1000000000000):
    p1 = s.find("01")
    p2 = s.find("10")
    if p1 == -1 and p2 == -1:
        break
    elif p1 == -1:
        i = p2
    elif p2 == -1:
        i = p1
    else:
        i = p1 if p1 < p2 else p2

    s = s[:i] + s[i + 2:]
    
print(o - len(s))