manacher algorithm for problem 5