use std::io::Write;
use std::cmp;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let margin = 10;

    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };
    let mut s = String::from(s);
    let len = s.len();
    for _ in 0..margin {
        s.push(' ');
    }
    debugln!("\"{}\"", s);
    debugln!("len: {}", len);
    debugln!("len after: {}", s.len());

    // dp[i][j]はs[i..j]が最後の区切りになるパターンの最大値
    let tmp_vec = vec![1; len + margin];
    let mut dp = vec![tmp_vec.clone(); len + margin];

    for i in 0..len {
        for j in 1..(4+1) {
            for k in 1..(4+1) {
                if s[i..(i+j)] != s[(i+j)..(i+j+k)] {
                    dp[i+j][i+j+k] = cmp::max(dp[i+j][i+j+k], dp[i][i+j] + 1)
                }
            }
        }
    }

    let mut result = 0;
    for i in 1..(4+1) {
        result = cmp::max(result, dp[len - i][len])
    }
    println!("{}", result);
}
