lina_os

Untitled

Mar 17th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3.  
  4. using namespace std;
  5.  
  6. ll MOD = 1e9+7;
  7.  
  8. ll npr(ll n, ll r){
  9. ll ans=n;
  10. for (int i=1; i<r; i++) {
  11. ans=ans%MOD*(n%MOD-i%MOD)%MOD;
  12. ans%=MOD;
  13. }
  14. return ans;
  15. }
  16.  
  17. int main() {
  18. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  19. string s;
  20. cin >> s;
  21. set<char>ss;
  22. for (int i=0; i<s.size(); i++) {
  23. ss.insert(s[i]);
  24. }
  25. cout << npr(s.size(),ss.size()-1)%MOD;
  26. return 0;
  27. }
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment