# ABC 120 C

import re

S = input()

base = len(S)

l = len(S)

while True:
    tmp = l
    S = re.sub('01', '', S)
    if l != len(S):
        l = len(S)

    S = re.sub('10', '', S)
    if l != len(S):
        l = len(S)

    if tmp == l:
        break

print(base - len(S))
