Advertisement
STANAANDREY

bacT15 sIII 2

May 24th, 2021
1,156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4. #define NMAX 103
  5. #define VOWELS "aeiou"
  6. char s[NMAX];
  7.  
  8. int main() {
  9.     cin.getline(s, NMAX);
  10.     char *word = strtok(s, " ");
  11.     int ans = 0;
  12.     while (word) {
  13.         int nrv = 0, nrc = 0;
  14.         for (int i = 0; word[i]; i++) {
  15.             if (strchr(VOWELS, word[i])) {
  16.                 nrv++;
  17.             } else {
  18.                 nrc++;
  19.             }
  20.         }
  21.         ans += nrc == nrv;
  22.         word = strtok(NULL, " ");
  23.     }
  24.     cout << ans << endl;
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement