s = input()
i = 0
c = 0
for _ in range(10**8):
    if len(s)==0 or i == len(s)-1:
        break
    if s[i] != s[i+1]:
        s = s[:i]+s[i+2:]
        c += 1
        i = 0
        continue
    i += 1
print(c*2)