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