S = [s for s in input()]
ans = 0
i = 1
while len(S) > 1 and i < len(S):
    if S[i] == S[i - 1]:
        i += 1
    else:
        S.pop(i)
        S.pop(i - 1)
        ans += 2
        i = 1
print(ans)        
