#include #include #include #include #include #define REP(i, a, b) for (int i = int(a); i < int(b); i++) #ifdef _DEBUG_ #define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl #else #define dump(val) #endif using namespace std; typedef long long int ll; template vector make_v(size_t a, T b) { return vector(a, b); } template auto make_v(size_t a, Ts... ts) { return vector(a, make_v(ts...)); } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); const int mod = 573; string s; cin >> s; int N = s.size(); auto mp = make_v(N + 1, N + 1, -1); function nCr = [&](int n, int r) -> int { if (mp[n][r] != -1) return mp[n][r]; if (n == r || r == 0) return 1; return mp[n][r] = (nCr(n - 1, r - 1) + nCr(n - 1, r)) % mod; }; vector cnt(26, 0); REP(i, 0, N) { cnt[s[i] - 'A']++; } int ans = 1; int rem = N; REP(i, 0, 26) { ans *= (nCr(rem, cnt[i])); ans %= mod; rem -= cnt[i]; } ans = (ans + mod - 1) % mod; cout << ans << endl; return 0; }