Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <vector>
- using namespace std;
- int main ()
- {
- int t;
- cin>>t;
- for(int i=0; i<t; i++)
- {
- vector <int> v;
- string s;
- cin>>s;
- int k=s.size();
- sort(s.begin(), s.begin()+k);
- for(int j=0; j<s.size(); j++)
- {
- v.push_back(j);
- }
- k=v.size();
- do
- {
- for(int z=0; z<k; z++)
- {
- cout<<s[v[z]];
- }
- cout<<endl;
- }while(next_permutation(v.begin(),v.begin()+k));
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement