S = list(input())

last = S.pop(0)
stack = [last]
cnt = 0
for s in S:
    if last != s:
        stack.pop()
        # stack.append(s) 読み捨て
        cnt += 2
    else:
        stack.append(s)
        last = s

print(cnt)