#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define all(a) a.begin(), a.end()
void solve() {
string s;cin >> s;
int ans = 0;
sort(all(s));
do {
int ok = 0;
char pre = ' ';
for (char i : s) {
if (i == pre) {
ok = 1;
break;
}
pre = i;
}
if (ok == 0)ans++;
} while (next_permutation(all(s)));
cout << ans << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int t = 1;
//cin >> t;
for (int i = 1; i <= t; i++) {
//cout << "----Test " << i << "----" << endl;
solve();
}
return 0;
}
全排列模拟

京公网安备 11010502036488号