Salesforce Interview Question

Lexicographically next permutation of a given string .