#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use itertools::Itertools;
use std::process::exit;
use std::cmp::*;
use num::*;
use num::integer::Roots;

fn main() {
    input! {
    a:String,
    }
    let mut a=a.chars().collect_vec();
    let mut v=vec![1;a.len()+10];
    for i in 1..a.len()-1 {
        if a[i-1]==a[i]{
            v[i+1]=v[i-1]+1
        }
        else {
            v[i]=max(v[i-1]+1,v[i])
        }
    }
    println!("{}",max(v[a.len()-1],v[a.len()-2]+1))
}