Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <cmath>
- #include <string.h>
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- long long factorial(long long n)
- {
- if (n == 0) {
- return 1;
- }
- return n * factorial(n - 1);
- }
- int main()
- {
- long long num = 0, same = 1;
- string s;
- cin >> s;
- vector <int> a(26);
- for (int i = 0; i < s.size(); ++i) {
- num = s[i];
- a[num - 97]++;
- }
- for (int i = 0; i < 26; ++i) {
- if (a[i] != 0) {
- same *= factorial(a[i]);
- }
- }
- cout << factorial(s.size()) / same;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement