from collections import defaultdict
S=input()

N=len(S)

if N==1:
    print(1)
    exit()

now=S[0]
ans=1

for i in range(1,N):
    s=S[i]
    if now!=s:
        ans+=1
        now=s
    else:
        now+=s
        if i==N-1:
            ans+=1

now=S[-1]
ans2=1

for i in range(N-2,-1,-1):
    s=S[i]
    if now!=s:
        ans2+=1
        now=s
    else:
        now=s+now
        if i==0:
            ans2+=1

print(max(ans, ans2))