Advertisement
Guest User

10098 - Generating Fast

a guest
Dec 14th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include<cstdio>
  2. #include<iostream>
  3. #include<algorithm>
  4. #include<cstring>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int t,len;
  11.     char ch;
  12.     char str[10000];
  13.  
  14.     scanf("%d%c",&t,&ch);
  15.     while(t--)
  16.     {
  17.         gets(str);
  18.         len=strlen(str);
  19.         sort(str,str+len);
  20.         do
  21.         {
  22.             cout<<str<<endl;
  23.         }while(next_permutation(str,str+len));
  24.  
  25.         cout<<endl;
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement