use std::cmp::max; fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let s: Vec = s.trim().chars().collect(); let mut result: usize = 1; for idx in 0..s.len() { let mut width = 1; let mut val = 0; while idx >= width && idx + width < s.len() { if s[idx - width] == s[idx + width] && s[idx - width] != ' ' { val += 2; } width += 1; } result = max(result, val + 1); width = 1; val = 0; while idx >= width && idx + width - 1 < s.len() { if s[idx - width] == s[idx + width - 1] && s[idx - width] != ' ' { val += 2; } width += 1; } result = max(result, val); } println!("{}", result); }