inpl = lambda: list(map(int,input().split()))
S = input()
N = len(S)
cur = ''
k = 0
i = -1
twin = False
for new in S:
    i += 1
    if twin:
        cur += new
        twin = False
    elif new != cur:
        k += 1
        prev = cur
        cur = new
    elif i < N-1:
        twin = True
        k += 1
        prev = cur
        cur = new
    else:
        cur *= 2
        if cur == prev:
            cur *= 2
            k -= 1
        else:
            pass
print(k)