S = input()
ans = 0
stack = []
for i in range(len(S)):
    if len(stack)==0:
        stack.append(S[i])
    if S[i] != stack[-1]:
        ans += 2
        stack.pop()
    else:
        stack.append(S[i])
print(ans)