solve longest palindromic substring