import re
S = input()
raw = len(S)
prev = len(S)
while True:
    S = re.sub(r"(10)+", "", S)
    S = re.sub(r"(01)+", "", S)
    if prev > len(S):
        prev = len(S)
    else:
        break
print(raw - len(S))
