Advertisement
ySiriuS17

Untitled

Nov 7th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. bool comp (string a, string b) {
  8. return a>b;
  9. }
  10.  
  11. int main()
  12. {
  13. vector <string> v;
  14. string s;
  15. while (cin>>s)
  16. v.push_back(s);
  17. sort(v.begin(),v.end(),comp);
  18. for (int i=0; i<v.size(); i++){
  19. cout<<v[i]<<' ';
  20. }
  21. cout<<endl;
  22. while(prev_permutation(v.begin(),v.end())){
  23. for (int i=0; i<v.size(); i++){
  24. cout<<v[i]<<' ';
  25. }
  26. cout<<endl;
  27. }
  28.  
  29.  
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement