fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. using ll = long long;
  5.  
  6. const ll mod = 1e9+7;
  7.  
  8. int N;
  9. string S;
  10.  
  11. ll ans = 1;
  12.  
  13. int main() {
  14. cin >> N >> S;
  15.  
  16. for(int c='a';c<='z';++c) {
  17. ll cnt = 1;
  18. for(int i=0;i<N;++i) {
  19. if(S[i] == c)++cnt;
  20. }
  21. ans *= cnt;
  22. ans %= mod;
  23. }
  24.  
  25. cout << ans-1 << endl;
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 15232KB
stdin
4
abcd
stdout
15