fork(143) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. char anagrama[13];
  9. cin>>anagrama;
  10. int len = strlen(anagrama);
  11. sort(anagrama, anagrama+len);
  12. do {
  13. cout << anagrama << endl;
  14. } while (next_permutation(anagrama, anagrama+len));
  15. return 0;
  16. }
Success #stdin #stdout 0s 2860KB
stdin
abcd
stdout
abcd
abdc
acbd
acdb
adbc
adcb
bacd
badc
bcad
bcda
bdac
bdca
cabd
cadb
cbad
cbda
cdab
cdba
dabc
dacb
dbac
dbca
dcab
dcba