- #include <iostream>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main()
- {string a;
- while(cin>>a){
- sort(a.begin(),a.end());
- do
- {
- cout<<a.begin()<<endl;
- }while(std::next_permutation(a.begin(),a.end()));
- }
- return 0;
- }
例子:
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1(希望我没写错-_________________-)