from sys import stdin
def S(): return stdin.readline().rstrip()

s = S()
ls = list(s)
l = []

while 0<len(ls):
    if len(l)<1:
        l.append(ls.pop(0))
    else:
        tmp = ls.pop(0)
        while tmp == l[len(l)-1]:
            if 0<len(ls):
                tmp += ls.pop(0)
            else:
                a = l.pop()
                tmp = a + tmp
                break
        l.append(tmp)

print(len(l))