s = list(input())

count = 0
torf = True
while torf:
    precount = count
    for i in range(len(s) - 1):
        if s[i] != s[i + 1]:
            s.pop(i)
            s.pop(i)
            count += 2
            break

    if precount == count:
        torf = False
    
print(count)