#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define INF 1145141919 #define INF_INT_MAX 2147483647 #define INF_LL_MAX 9223372036854775807 #define EPS 1e-10 #define Pi acos(-1) #define LL long long #define ULL unsigned long long using namespace std; #define mod 573 #define MAX_C 1001 int C[MAX_C][MAX_C]; void init(){ C[0][0] = 1; for (int i = 1; i < MAX_C; i++){ for (int j = 0; j <= i; j++){ if (j == 0 || j == i){ C[i][j] = C[i - 1][0]; } else{ C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod; } } } } int main() { init(); string S; cin >> S; map M; for (int i = 0; i < S.length(); i++){ M[S[i]]++; } int N = S.length(); int ans = 1; for (char c = 'A'; c <= 'Z'; c++){ ans = (ans * C[N][M[c]]) % mod; N -= M[c]; } cout << (ans-1) % mod << endl; return 0; }