S = input()
l = len(S)
T = list(S)


tmp = 0

while tmp != len(T)-1:
    if T[tmp] != T[tmp+1]:
     
        T.pop(tmp)
        T.pop(tmp)
        tmp -= 1
    else:

        tmp += 1





k = len(T)

ans = l - k

print(ans)

