fn solve(s: String) -> usize {
    let n = s.len();
    let mut cs = s.chars().collect::<Vec<_>>();

    let mut ans = 1;
    let mut last = 0;
    let mut i = 1;

    loop {
        if i >= n {
            return ans;
        }

        if cs[last] != cs[i] {
            last += 1;
            i += 1;
            ans += 1;
            continue;
        }

        if i == n - 1 {
            return ans;
        }

        ans += 2;
        last += 3;
        i += 3;
    }
}

#[test]
fn solve_test() {
    assert_eq!(solve("a".to_owned()), 1);
    assert_eq!(solve("ab".to_owned()), 2);
    assert_eq!(solve("aa".to_owned()), 1);
    assert_eq!(solve("aaba".to_owned()), 3);

    assert_eq!(solve("aabbaa".to_owned()), 4);
    assert_eq!(solve("aaaccacabaababc".to_owned()), 12);
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let s = read_line!();
    println!("{}", solve(s));
}
