S = input()

def func(s):
    s = list(s)
    for idx in range(1, len(s)):
        if s[idx] == s[idx - 1]:
            continue
        else:
            del s[idx-1:idx+1]
            break
    return ''.join(s)

n = 0
while(1):
    if '01' not in S:
        if '10' not in S:
            break
    
    S = func(S)
    n += 2

print(n)