s = list(input())
ans = 0
while True:
    end = 0
    for i in range(len(s) - 1):
        if len(s) == 0:
            end = 0
            break
        if s[i] != s[i + 1]:
            ans += 2
            end = 1
            del s[i:i + 2]
            break
    if end == 0:
        break
print(ans)