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