fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let n: u64 = s.trim().parse().unwrap(); for i in 1.. { if format!("{i}{i}{i}").parse::().unwrap() > n { println!("{}", i - 1); break; } } }