import numpy as np

s = input()
s = np.asarray(list(s))
ans = 0
while True:
    delidx = []
    i = 0
    while i < len(s)-1:
        if s[i] != s[i+1]:
            delidx.append(i)
            delidx.append(i+1)
            i = i+1
            ans = ans+2
        i = i+1
    if len(delidx) == 0 or len(s) == 0:
        break
    s = np.delete(s, delidx)
print(ans)

