#include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) typedef long long ll; int const MOD = 573; ll comb[1010][1010]; void make_comb(int n) { rep(i, n+1) { comb[i][0] = 1; REP(j, 1, i+1) { comb[i][j] = comb[i-1][j-1] + comb[i-1][j]; comb[i][j] %= MOD; } } } int main() { make_comb(1005); string s; cin >> s; int sz = s.size(); int mp[26]={}; rep(i, sz) { mp[s[i]-'A']++; } ll ans = 1; rep(i, 26) { if(mp[i]) { ans *= comb[sz][mp[i]]; sz -= mp[i]; } } cout << ans-1 << endl; return 0; }