#include <iostream>
#include <vector>
using namespace std;
int num[26];
int len;
int ans = 0;
vector<pair<int, int> > v;
void dfs(int depth, int prev) {
if (depth == len) {
ans++;
return;
}
for (int i = 0; i < v.size(); i++) {
if (v[i].second == 0) continue;
if (v[i].first != prev) {
v[i].second--;
dfs(depth + 1, v[i].first);
v[i].second++;
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string s;
cin >> s;
len = s.length();
for (int i = 0; i < s.length(); i++) {
num[s[i] - 'a']++;
}
for (int i = 0; i < 26; i++) {
if (num[i] == 0) continue;
v.push_back({ i,num[i] });
}
dfs(0,-1);
cout << ans << "\n";
return 0;
}