S = input()
res = 0
while S:
    p = S[0]
    T = []
    i = 1
    while i < len(S):
        if S[i] != S[i-1]:
            i += 1
            res += 2
        else:
            T.append(S[i])
        i += 1
    if len(S) == len(T):
        break
    S = T
print(res)