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(\
void permute(string set, string prefix = ""){ if(set.length() == 1){ cout<<"\n"<
And simply use it as permute("word");