fork(5) download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. int main()
  5. {
  6. std::string str = "ACB";
  7. sort(str.begin(), str.end());
  8.  
  9. do {
  10. std::cout << str << " ";
  11. } while(std::next_permutation(str.begin(), str.end()));
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 16056KB
stdin
Standard input is empty
stdout
ABC ACB BAC BCA CAB CBA