s = list(input())
ans = 0
while True:
    t = []
    i = 0
    while i < len(s) - 1:
        if s[i] == s[i+1]:
            i += 1
            t.append(s[i])
        elif s[i] != s[i+1]:
            i += 2
            ans += 2
    t.append(s[-1])
    s = t
    if all([item == '1' for item in s]) or all([item == '0' for item in s]) or len(s) == 0:
        break
print(ans)
