Solve PalindromePartition.