O(n) longest palindrome for learning