s=gets.chars (s.size-1).downto(1){|i|s.each_cons(i){|j| j==j.reverse&&[(puts j.size),exit] }}