# AtCoder
S = input()

stack = []
count = 0
for e in S:
    if stack == []:
        stack.append(e)

    if stack[-1] != e:
        stack.pop(-1)
        count += 2
        continue
    else:
        stack.append(e)


print(count)
