#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); string S; cin >> S; ll siz = S.size(); vector cnt(26, 0); rep(i, 0, siz) cnt[S[i] - 'A']++; ll ans = 1; rep(i, 1, siz + 1) ans *= i; rep(i, 0, 26) rep(j, 1, cnt[i] + 1) ans /= j; cout << ans - 1 << '\n'; }