Ankit_132

B

Dec 6th, 2023
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define ll     long long
  7. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  8.  
  9. int main()
  10. {
  11.     _test
  12.     {
  13.         int n;
  14.         string s;
  15.         cin>>n>>s;
  16.  
  17.         vector<int> cnt(26);
  18.         for(auto e: s)
  19.             cnt[e-'a']++;
  20.  
  21.         ll int ans = 1;
  22.         int MOD = 1e9 + 7;
  23.  
  24.         for(auto e: cnt)
  25.             (ans *= (e+1)) %= MOD;
  26.  
  27.         cout<<(ans-1)<<"\n";
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment