#include #include using namespace std; #define MOD 573 void count(string S, int countList[26]) { int n = S.size(); for (int j = 0; j < n; j++) { for (int i = 0; i < 26; i++) { if (S[j] == (char)(i+'A')) countList[i]++; } } } int main() { string S; cin >> S; int ans; int countList[26] = {}; int fact[1001]; fact[0] = 1; for (int i = 1; i < 1000; i++) { fact[i] = (fact[i-1] * i) % MOD; } count(S, countList); ans = fact[S.size()]; for (int i = 0; i < 26; i++) { ans /= fact[countList[i]]; ans %= MOD; } ans--; cout << ans << endl; return 0; }