use whiteread::parse_line;

fn main() {
    let s: String = parse_line().unwrap();
    let s: Vec<char> = s.chars().collect();
    let mut k = 0;
    let len = s.len();
    let mut idx = 0;

    while idx < len - 2 {
        if s[idx] == s[idx + 1] || s[idx + 1] == s[idx + 2] {
            idx += 3;
        } else {
            idx += 2;
        }
        k += 2;
    }
    k += match len - idx {
        0 => 0,
        2 if s[idx] != s[idx + 1] => 2,
        _ => 1,
    };
    println!("{}", k);
}
