fn is_palindrome(s: &str) -> bool { let mut l = 0; let mut r = s.len() - 1; while l <= r { if s[l..=l] != s[r..=r] { return false; } l += 1; r -= 1; } true } fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let s = s.trim(); for len in (2..s.len()).rev() { for l in 0..=(s.len() - len) { let r = l + len; if is_palindrome(&s[l..r]) { println!("{len}"); return; } } } println!("1"); }