#include <bits/stdc++.h>
using namespace std;
void backtrack(string str, vector<bool> used, int len, int &num) {
if (len == str.size()) {
num++;
return;
}
for (int i = 0; i < str.size(); i++) {
if (used[i] == true) continue;
if (i > 0 && str[i] == str[i - 1] && used[i - 1] == false) continue;
used[i] = true;
backtrack(str, used, len + 1, num);
used[i] = false;
}
}
int main() {
string str;
cin >> str;
sort(str.begin(), str.end());
int num = 0;
vector<bool> used(str.size(), false);
backtrack(str, used, 0, num);
cout << num;
return 0;
}