String sort solution for palindrome testing