Saturday, April 2, 2016

STL next_permutation(array,array+size)

#include<bits/stdc++.h>

using namespace std;

int main()
{
 char a[10];
 int l;
 cin>>a;
 l=strlen(a);
 sort(a,a+l);
 do{
  cout<<a<<endl;
 }
 while(next_permutation(a,a+l));
 return 0;
}

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)