S = input()
N, ans, i = len(S), 0, 0
while i < N:
    if S[i+1:i+2] != '' and S[i:i+1] != S[i+1:i+2]:
        S = S[0:i] + S[i+2:N]
        ans, i, N = ans + 2, 0, N - 2
    else:
        i += 1
print(ans)