(defun solve (xs)
  (labels ((dp (xs)
             (cond
               ((null xs) 0)
               ((null (rest xs)) 1)
               ((= (length xs) 2)
                (if (equal (first xs) (second xs))
                    1
                    2))
               ((equal (first (last xs))
                       (first (last xs 2))) (+ (dp (butlast xs 3)) 2))
               (t                           (+ (dp (butlast xs)) 1)))))
    (dp xs)))

(defun main ()
  (let ((xs (concatenate 'list (read-line))))
    (princ (solve xs))
    (fresh-line)))

(main)
