fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. string s;
  6. cin >> s;
  7.  
  8. sort(s.begin(), s.end());
  9.  
  10. while(next_permutation(s.begin(), s.end()))
  11. cout << s << endl;
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 3476KB
stdin
hello
stdout
ehlol
eholl
elhlo
elhol
ellho
elloh
elohl
elolh
eohll
eolhl
eollh
hello
helol
heoll
hlelo
hleol
hlleo
hlloe
hloel
hlole
hoell
holel
holle
lehlo
lehol
lelho
leloh
leohl
leolh
lhelo
lheol
lhleo
lhloe
lhoel
lhole
lleho
lleoh
llheo
llhoe
lloeh
llohe
loehl
loelh
lohel
lohle
loleh
lolhe
oehll
oelhl
oellh
ohell
ohlel
ohlle
olehl
olelh
olhel
olhle
olleh
ollhe