#include #include #include #include #include #include #include #include #include using namespace std; #define FOR(x,y) for(int x = 0;x < y;x++) #define LLI long long int #define FORR(x,arr) for(auto& x:arr) #define ALL(a) (a.begin()),(a.end()) template class UF { public: vector _parent,_rank; UF() { _parent=_rank=vector(um,0); for(int i=0;i_rank[yRoot]) { _parent[xRoot] = yRoot; return yRoot; } if(_rank[xRoot]<_rank[yRoot]) { _parent[yRoot] = xRoot; return xRoot; } if(xRoot != yRoot) { _parent[yRoot] = xRoot; _rank[xRoot]++; return xRoot; } return xRoot; } }; map counts; int main() { string texts; cin >> texts; FOR(i, texts.length()) { counts[texts[i]]++; } int sum = 1; for(int i = 1;i <= texts.length();i++) { sum *= i; } FORR(r, counts) { if(r.second >1) { int d = 1; for(int a = 0;a < r.second;a++) { d *= (a + 1); } sum /= d; } } sum--; cout << sum << endl; return 0; }