s = input()
lst = []
if len(s) == 1:
    print(1)
    exit()
q = 0
while q+1 <= len(s)-1:
    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])

cnt = 0
for i in range(len(lst)-1):
    if lst[i] != lst[i+1]:
        cnt += 1
else:
    if lst[i-1] != lst[i-2]:
        cnt += 1
print(cnt)