Advertisement
STANAANDREY

tema dragos pb2

Jan 5th, 2022
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #define VOWELS "aeiouAEIOU"
  4. using namespace std;
  5.  
  6. bool isOk(char *s) {
  7.     int nrv = 0;
  8.     for (int i = 0; VOWELS[i]; i++) {
  9.         if (strchr(s, VOWELS[i])) {
  10.             nrv++;
  11.         }
  12.     }
  13.     return nrv == 1;
  14. }
  15.  
  16. int main() {
  17.     char s[102];
  18.     gets(s);
  19.     char *p = strtok(s, " ");
  20.     while (p) {
  21.         if (isOk(p)) {
  22.             puts(p);
  23.         }
  24.         p = strtok(NULL, " ");
  25.     }
  26.     return 0;
  27. }
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement