fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5. const int M = 1e9 + 7;
  6. signed main()
  7.  
  8. {
  9. ios_base::sync_with_stdio(false);
  10. cin.tie(NULL);
  11. int w;
  12. cin >> w;
  13.  
  14. while (w!=0)
  15. {
  16. set<char> v;
  17. v.insert('c');
  18. v.insert('g');
  19. v.insert('l');
  20. v.insert('r');
  21. int n;
  22. string s;
  23. cin >> n >> s;
  24. long long l = 1;
  25. for (char ch : s)
  26. if (v.find(ch) != v.end())
  27. l = (l* 2) % M;
  28. cout << l << '\n';
  29. w=w-1;
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5540KB
stdin
4
5
aeiou
5
abcde
8
starters
8
codechef

stdout
1
2
4
4