fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int vow(char s){
  4. if(s=='a' || s=='e' || s=='i' || s=='o' || s=='u'){
  5. return 1;
  6. }
  7. else
  8. return 0;
  9. }
  10. int main() {
  11. int t,i;
  12. string str;
  13. cin>>t;
  14. while(t--){
  15. int n,count=0;
  16. cin>>n;
  17. cin>>str;
  18. for(i=0;i<n-1;i++){
  19. if(!vow(str[i]) && vow(str[i+1])){
  20. count++;
  21. }
  22. }
  23. cout<<count<<endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 15240KB
stdin
3
6
bazeci
3
abu
1
o
stdout
3
1
0