s = input()
lst = []
lst2 = []

if len(s) == 1:
    print(1)
    exit()

q = 0
while q <= len(s)-2:
    if s[q] == s[q+1]:
        lst.append(s[q])
        if q+1 != len(s)-1:
            lst.append(s[q+1:q+3])
        q += 3
    else:
        lst.append(s[q])
        q += 1
else:
    if s[-1] != lst[-1]:
        lst.append(s[-1])

q = 0
t = s[::-1]
while q <= len(t)-2:
    if t[q] == t[q+1]:
        lst2.append(t[q])
        if q+1 != len(t)-1:
            lst2.append(t[q+1:q+3])
        q += 3
    else:
        lst2.append(t[q])
        q += 1
else:
    if t[-1] != lst2[-1]:
        lst2.append(t[-1])

print(max(len(lst),len(lst2)))