#!/usr/bin/env python

import sys

s= sys.stdin.readline().strip()
n= len(s)
i=0
c=0
while i<n:
    if i==n-1:
        c= c+1
        i+=1
    elif i==n-2:
        if s[i]==s[i+1]: c+=1
        i+=2
    else:
        s0= s[i]
        s1= s[i+1]
        s2= s[i+2]
        if s0!=s1 and s1!=s2:
            c= c+3
        else:
            c= c+2
        i= i+3
#
print( c )
