O(nlog(n)) with LongestPalindromicSubstring