#include <iostream>
#include <string>
using namespace std;
int book[1000];
char a[1000];
void find_string(string &s, int len,int n) {
if (n == len ) {
for (int i = 0; i < len; i++)
cout << a[i] << " ";
cout << endl;
return;
}
for (int i = 0; i < len; i++) {
if (book[i] == 0) {
a[n] = s[i];
book[i] = 1;
find_string(s, len, n + 1);
book[i] = 0;
}
}
return;
}
int main() {
string s;
cin >> s;
find_string(s, s.size(), 0);
system("pause");
}
字符串的排列
最新推荐文章于 2023-09-20 10:40:24 发布