S=input()
S='9'+S+'9'
ans = 0
while 1:
    flg=True
    for i in range(len(S)-1):
        if S[i]!=S[i+1] and S[i]!=9 and S[i+1]!=9:
            S=S[:i]+S[i+2:]
            ans += 2
            flg=False
            break
    if flg:
        print(ans)
        exit()