fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int factorial(int p)
  4. {
  5. if (p == 0)
  6. return 1;
  7. else
  8. return(p * factorial(p-1));
  9. }
  10. int main()
  11. {
  12. char ppk[10];
  13. cin >> ppk;
  14. int N[26]={0};
  15. int j=0;
  16. while(ppk[j]!='\0')
  17. {
  18. N[ppk[j]-'a']++;
  19. j++;
  20. }
  21. int permutat;
  22. permutat=factorial(strlen(ppk));
  23. for(int i=0;i<26;i++)
  24. {
  25. if(N[i]>=2)
  26. {
  27. permutat=permutat/factorial(N[i]);
  28. }
  29. }
  30. cout << permutat;
  31. return 0;
  32. }
Success #stdin #stdout 0s 5556KB
stdin
Standard input is empty
stdout
1