fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. vector<string> s;
  10. s.push_back("quick");
  11. s.push_back("brown");
  12. s.push_back("fox");
  13. sort(s.begin(), s.end());
  14. do {
  15. for(int i = 0 ; i != s.size() ; i++) {
  16. cout << s[i] << " ";
  17. }
  18. cout << endl;
  19. } while (next_permutation(s.begin(), s.end()));
  20. return 0;
  21. }
Success #stdin #stdout 0.02s 2820KB
stdin
Standard input is empty
stdout
brown fox quick 
brown quick fox 
fox brown quick 
fox quick brown 
quick brown fox 
quick fox brown