# coding: utf-8
# Your code here!
S = input()
ans = 1
prev=S[0]
now = ""
temp=""
i = 1
if len(S) != 1:
    while(1):
        now=S[i]
        flg=False
        while(prev == now and i < len(S)-1):
            now += S[i+1]
            i+=1
        # print(i, prev, now)
        temp=prev
        prev = now
        i+=1
        ans+=1
        if i >= len(S):
            break
if temp == now:
    ans -= 1
print(ans)
