#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let s: String = read!();
    let s = s.chars().collect_vec();

    let mut str = String::new();
    let mut ans = 0;
    for &c in &s {
        if &format!("{}", c) != &str {
            str = format!("{}", c);
            ans += 1;
        } else {
            str.push(c);
        }
    }

    if s[s.len() - 1] == s[s.len() - 2] {
        ans += 1;
    }

    println!("{}", ans);
}
