use std::io; macro_rules! parse_input { ($x:expr, $t:ident) => ($x.trim().parse::<$t>().unwrap()) } macro_rules! print_err { ($($arg:tt)*) => ( { use std::io::Write; writeln!(&mut ::std::io::stderr(), $($arg)*).ok(); } ) } fn main() { let mut input_line = String::new(); io::stdin().read_line(&mut input_line).unwrap(); // let inputs = input_line.split(" ").collect::>(); // let k = parse_input!(inputs[0], i32); // let r = parse_input!(inputs[1], i32); let cs = input_line.chars(); let mut c_num: u32 = 0; let mut w_num: u32 = 0; for c in cs { if c == 'c' { c_num += 1; } else if c == 'w' { w_num += 1; } } if c_num - 1 < w_num { println!("{}", c_num - 1); } else { print!("{}", w_num); } }