#include #include #include using namespace std; int fact(int n) { int result = 1; for (int i = 2; i <= n; i++) { result *= i; } return result; } int main(int argc, char **argv) { string S; cin >> S; vector V(26); for (char ch : S) V[ch - 'A']++; int result = fact(S.length()); for (int n : V) result /= fact(n); cout << result << endl; }