PayPal interview question

Find next permutation of a string