Given a String S, We can reverse atmost one substring of S. Find what is largest lexicographically String that can be acheived.
e.g.:
Input String S: "ashish",
Output: "sihsah"
Can anyone please help in the algorithm. Or have any referece artcile on this.