s = input()

ans = 0
stack = [s[0]]
flg = False
for i in range(1,len(s)):
        if len(stack) > 0:
            if stack[0] != s[i]:
                ans += 2
                stack.pop(0)
            else:
                stack.insert(0, s[i])
        else:
            stack.insert(0, s[i])

print(ans)
