can u check the backtracking steps
#include
using namespace std;
void permute(char *in, char *out, int i, int j) {
if (in[i] == ‘\0’) {
out[j] = ‘\0’;
cout << out << endl;
return;
}
for (int k = i; in[k] != '\0'; k++) {
swap(in[i], in[k]);
out[j] = in[i];
permute(in, out, i + 1, j + 1);
out[j] = in[i];
}
return;
}
int main() {
char in[100];
cin >> in;
char out[100];
permute(in, out, 0, 0);
return 0;
}