Salesforce interview question

Lexicographically next permutation of a given string .