s=[int(i) for i in input()]
n=len(s)
updated=True
while updated:
    updated=False
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            del s[i]
            del s[i]
            updated=True
            break

print(n-len(s))
