# require 'pry'

S = gets.chomp.to_s.split('')
N = S.size

@elements = []
@pass = false

S.each_with_index do |s, i|

  if i == (N - 3) && s.size == 2
    if S[i+1] == S[i+2] # 最後の二つが同じとき
      if s == (S[i+1] + S[i+2])
        @elements << s + S[i+1]
        @elements << S[i+2]
      else
        @elements << s
        @elements << S[i+1] + S[i+2]
      end
    else
      @elements << s
      @elements << S[i+1]
      @elements << S[i+2]
    end
    break # おわり
  end

  
  # binding.pry
  

  if @pass
    break if i == (N - 1)
    S[i+1] = s + S[i+1]
    @pass = false
    next
  else
    @elements << s
  end

  if s == S[i+1]
    @pass = true
    next
  end if i != (N-1)

end

# print @elements

print @elements.count
