s = input()
s_len = len(s)
count = 0
s = [s[i:i+3] for i in range(0,len(s),3)]
s_new = []
for i in s:
    s_new.append(i[0])
    s_new.append(i[1:3])
if s_new[len(s_new)-1]=='':
    s_new.remove('')
ans = len(s_new)
#print(s_new)
for i in range(1,len(s_new),2):
    if i!=len(s_new)-1:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1] and s_new[i][1]!= s_new[i+1]:
            ans += 1
    else:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1]:
            ans += 1
print(ans)
