def f(s):
    l=len(s)
    if l==1:
        return 1
    ret=l
    prev=s[0]
    for i in range(1,l-1):
        if s[i]==prev:
            ret-=1
            prev=s[i]+s[i+1]
        else:
            prev=s[i]
    if prev==s[-1]:
        ret-=1
    return ret

s=input()
ans=max(f(s),f(s[::-1]))
print(ans)