#include <iostream>
#include <cstring>
#include <string>
#define MAXSIZE 256
#define PATSIZE 10
using namespace std;
void permute(char str[], int l, int r)
{
if(l==r)
{
cout<< str << endl;
return;
}
for(int i=l;i<=r;i++)
{
swap(str[l], str[i]);
permute(str, l+1, r);
swap(str[l], str[i]);
}
}
int main() {
// your code goes here
char txt[] = "abcd";
permute(txt, 0, strlen(txt)-1);
return 0;
}
No comments:
Post a Comment