Advertisement
Spocoman

01. How Many Vowels

Dec 10th, 2023
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     string vowels = "AEIOUYaeiouy";
  6.  
  7.     int n, vowelNumbers = 0, symbolNumbers = 0;
  8.     cin >> n;
  9.  
  10.     char chr;
  11.  
  12.     for (size_t i = 0; i < n; i++) {
  13.         cin >> chr;
  14.         if (isalpha(chr)) {
  15.             if (vowels.find(chr) != -1) {
  16.                 vowelNumbers++;
  17.             }
  18.             else {
  19.                 symbolNumbers++;
  20.             }
  21.         }    
  22.     }
  23.    
  24.     cout << vowelNumbers << ' ' << symbolNumbers << endl;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement