Java program to implement above approach
import java . util . * ; class GFG { public static int sortString ( String S ) { Vector < Integer > sorted = new Vector < Integer > ( ) ; Vector < Integer > original = new Vector < Integer > ( ) ; boolean insert = false ;