def main
  s = readlines.map {|l| l.chomp }[0]
  k = 0
  a = s.chars
  pre_s = ""
  cur_s = ""
  len = s.size
  flag = false
  a.each_with_index do |c, i|
    if i == (len - 4)
      if s[i..(len)].chars.uniq == 1
        k += 3
        flag = true
        break
      end
    end
    cur_s += c
    if pre_s != cur_s
      k += 1
      pre_s = cur_s
      cur_s = ""
    end
  end
  puts k
end

if __FILE__ == $0
  main
end
