S = input()
N = len(S)

ans = 0
status = 0
while True:
    #print (len(S))
    for i in range(len(S)):
        if i<len(S)-1 and S[i] != S[i+1]:
            S = str(S[:i]) + str(S[i+2:])
            ans += 2
            break
        if i == len(S)-1:
            status = 1
    if S == "" or status == 1:
        print(ans)
        break