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

num = 0
for i in range (len(l)-1):
  if s[l[i]] == s[l[i+1]]:
    num = num + 1

ans = ans + int(num//2)+1
print(ans)