fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int n, cnt;
  8. string str;
  9.  
  10. cin>>n;
  11.  
  12. while(n--){
  13. cin>>str;
  14. cnt=0;
  15.  
  16. for(int i=0;i<str.length();i++){
  17. if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u')
  18. cnt++;
  19. }
  20.  
  21. cout<<"The number of vowels in "<<str<<" is "<<cnt<<".\n";
  22. }
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5320KB
stdin
3
despicable
gru
nth
stdout
The number of vowels in despicable is 4.
The number of vowels in gru is 1.
The number of vowels in nth is 0.