s = input()

N = len(s)
a = []
b = []
a.append(s[0])
sr = s[::-1]
b.append(sr[0])

i = 1
j = 1
while i < N-1:
    pre = a[j-1]
    tmp = s[i]
    if pre == s[i]:
        tmp += s[i+1]
        i += 1
    a.append(tmp)
    i += 1
    j += 1
if len(a[-1]) != 2:
    a.append(s[-1])

i = 1
j = 1
while i < N-1:
    pre = b[j-1]
    tmp = sr[i]
    if pre == sr[i]:
        tmp += sr[i+1]
        i += 1
    b.append(tmp)
    i += 1
    j += 1
if len(b[-1]) != 2:
    b.append(sr[-1])

ans = len(a)
if a[-1] == a[-2]:
    ans -= 1

ans2 = len(b)
if b[-1] == b[-2]:
    ans2 -= 1

print(max(ans, ans2))