use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let mut s: Vec<char> = read::<String>().chars().collect();

    let mut ans = 0;
    let mut prev = String::new();
    let mut now = String::new();

    while let Some(c) = s.pop() {
        now.push(c);
        if now == prev {
            continue;
        } else {
            ans += 1;
            prev = now.clone();
            now.clear();
            now.push(c);
        }
    }
    println!("{}", ans - 2);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}
