#include using namespace std; int kai(int n) { if(n == 1) return 1; return n * kai(n-1); } int main() { string s; cin >> s; vector cnt(26,0); for(int i = 0; i < s.length(); i++) cnt[s[i]-'A']++; int a,b,c = 0; a = kai(s.length()); for(int i = 0; i < 26; i++){ if(cnt[i] <= 1) continue; b = kai(cnt[i]); if(b > 1) c += b; } if(!c) c = 1; cout << a / c - 1 << endl; return 0; }