s = input()
s = list(s)
ans = 1
let = []
for i in range (len(s)-1):
  if s[i] != s[i+1]:
    ans = ans + 1
  elif s[i] == s[i+1]:
    let.append(i)
#print(let)
#print(s[0]+s[1])

for i in range (len(let)-1):
  if s[let[i]] == s[let[i+1]]:
    if (s[let[i]]+s[let[i+1]]) != (s[let[i+1]]+s[let[i+2]]):
      ans = ans +1

print(ans)