S = input()
li = list(S)
ans = 0
found = 1
while found != 0:
    found = 0
    for i in range(len(li)-1):
        if li[i] != li[i+1]:
            del li[i+1]
            del li[i]
            ans += 2
            found = 1
            break
print(ans)

