s = input()

complete = False
ans = 0

while complete == False:
    complete = True
    i = 0
    while i < len(s) - 1:
        if s[i] != s[i+1]:
            s = s[:i] + s[i+2:]
            ans = ans + 2
            complete = False
        i = i + 1

print(ans)