S = input()
S_array = []

for i in S:
    S_array.append(i)
    
answer = 0
i = 1

while (i <= len(S_array) -1):
    if len(S_array) < 2:
        print(answer)
        break
    elif S_array[i] != S_array[i-1]:
        del S_array[i-1:i+1]
        i = 1
        answer += 2
    else:
        i += 1
    print(answer)