熟悉下permutation吧
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int main() { string s; while (cin>>s) { do{ cout<<s<<endl; }while(next_permutation(s.begin(),s.end())); } return 0; }
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int main() { string s; while (cin>>s) { do{ cout<<s<<endl; }while(next_permutation(s.begin(),s.end())); } return 0; }