permutations of a string in sorted manner