s=gets.chomp n=s.size p (n...n*n).map{|x|t=s[x%n,x/n];t!=t.reverse ? 0:x/n}.max