s = gets n = s.size kaibun_max = 0 tmp = "" n.times{|i| i.upto(n-1){|j| tmp = s[i..j] if tmp == tmp.reverse && tmp.size < s.size kaibun_max = [kaibun_max,tmp.size].max end } } puts kaibun_max