S = list(input())
cnt = 0
i = 0
while True:
    if S[i] != S[i + 1]:
        del S[i:i+2]
        cnt += 1
        i = 0
        continue
    elif i + 2 == len(S):
        print(cnt * 2)
        exit()
    i += 1





