题解 | #全排列#
全排列
https://www.nowcoder.com/practice/5632c23d0d654aecbc9315d1720421c1
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
vector<string> store;
void wholesort(string pre,string x){
if(x.length()==1){
cout<<pre+x<<endl;
}
for(int i=0;i<x.length();i++){
string nextpre;
string nextx=x.substr(0,i)+x.substr(i+1);
nextpre=pre+x[i];
wholesort(nextpre, nextx);
}
}
int main() {
string x;
while(cin>>x){
wholesort("", x);
}
}
