fork download
  1. #include <iostream>
  2. using namespace std;
  3. const int m=1e9+7;
  4. int v(int n,string s)
  5. {
  6. int c=1;
  7. for(int i=0;i<n;i++)
  8. if(s[i]=='c' || s[i]=='r' || s[i]=='l' || s[i]=='g')
  9. c=(c*2)%m;
  10. return c;
  11. }
  12. int main() {
  13. int k;
  14. cin>>k;
  15. while(k--)
  16. {
  17. int n;
  18. string s;
  19. cin>>n>>s;
  20. int f;
  21. f=v(n,s);
  22. cout<<f<<endl;
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5304KB
stdin
4
5
aeiou
5
abcde
8
starters
8
codechef
stdout
1
2
4
4