#include #include #include #include #include #include #include #include #include // require sort next_permutation count __gcd reverse etc. #include // require abs exit atof atoi #include // require scanf printf #include #include // require accumulate #include // require fabs #include #include #include #include // require setw #include // require stringstream #include // require memset #include // require tolower, toupper #include // require freopen #include // require srand #define rep(i,n) for(int i=0;i<(n);i++) #define ALL(A) A.begin(), A.end() #define each(i,c) for(auto i=(c).begin();i!=(c).end();++i) #define exist(s,e) ((s).find(e)!=(s).end()) #define clr(a) memset((a),0,sizeof(a)) #define nclr(a) memset((a),-1,sizoef(a)) #define sz(s) (int)((s).size()) #define INRANGE(x,s,e) ((s)<=(x) && (x)<(e)) #define pb push_back #define MP(x,y) make_pair((x),(y)) using namespace std; typedef long long ll; typedef pair P; const ll MOD = 573LL; const int MAX_P = 1005; ll dp[1005][1005]; void init_comb (void ){ memset (dp, 0LL, sizeof (dp ) ); rep (i, MAX_P ) dp[i][0] = 1LL; rep (j, MAX_P ) dp[0][j] = 1LL; for (int k = 1; k < MAX_P; k++ ){ for (int j = 1; j <= k; j++ ){ int i = k - (j-1); dp[i][j] = (dp[i][j-1] + dp[i-1][j] ) % MOD; } // end for } // end for } ll comb(int n, int k ){ return dp[n-k][k]; } int main() { init_comb (); ios_base::sync_with_stdio(0); string s; cin >> s; int n = s.length(); map cnt; cnt.clear(); rep (i, n ){ cnt[s[i]]++; } // end rep ll res = 1LL; map::iterator it = cnt.begin(); for (; it != cnt.end(); it++ ){ char c = (*it).first; int r = (*it).second; res = (res * comb(n, r ) ) % MOD; n -= r; } // end for cout << res - 1LL << endl; return 0; }