S = str(input())
i, ans = (0, 0)
while i>=0 and i<len(S)-1:
    print(S)
    if S[i]!=S[i+1]:
        S = S[:i]+S[i+2:] if i+2<len(S) else S[:i]
        ans += 2
        i = max(0, i-1)
    else:
        i+=1
print(ans)
