from math import ceil
s=input()
n=len(s)
cnt=0
l=[]
i=0
if n==1:
  print(1)
elif n==2:
  if s[0]==s[1]:
    print(1)
  else:
    print(2)
else:
  for i in range(n):
    if i%3==0:
      l.append(s[i])
    elif i%3==1:
      if i==n-1:
        l.append(s[i])
      else:
        l.append(s[i]+s[i+1])
  for i in range(len(l)):
    if len(l[i])==1:
      cnt+=1
    else:
      if i==len(l)-1:
        if l[i][0]==l[i-1] or l[i][0]==l[i][1]:
          cnt+=1
        else:
          cnt+=2
      else:
        if (l[i][0]==l[i-1] or l[i][1]==l[i+1]) or l[i][0]==l[i][1]:
          cnt+=1
        else:
          cnt+=2
  print(cnt)