#include using namespace std; typedef unsigned long long ul; typedef signed long long ll; ul over = 1000000007; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cout << fixed; string s; cin >> s; int az[26]; for (int i = 0; i < 26; ++i) az[i] = 0; for (auto c : s) { az[c-'A']++; } ll ans = 1; for (int i = 2; i <= s.size(); ++i) ans *= i; for (int i = 0; i < 26; ++i) { if (az[i] > 1) { ll divaz = 1; for (int j = 2; j <= az[i]; ++j) divaz *= j; ans /= divaz; } } cout << ans-1 << endl; return 0; }