S = list(input())
from collections import deque
S = deque(S)
f = S.popleft()
stocked = f
ans = 0
while S:
    n = S.popleft()
    if f!=n:
        ans += 1
        if not S:
            break
        f = S.popleft()
    else:
        stocked = f
        f = n
if stocked!=n:
    ans += 1
print(ans*2)