Here is a standard function to print the permutations of characters of a string:
void permute(char *a, int i, int n) { int j; if (i == n) printf(\
Algorithm steps:
I think, this is best and efficient solution.