Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include <string.h>
  4.  
  5. int syllablecnt(const char *s)
  6. {
  7.     static char lt[12] = {'a','e','i','o','u','y','A','E','I','O','U','Y'};
  8.     int ans = 0;
  9.     const char *curr = s;
  10.     bool prev = 0;
  11.     while (*curr != 0)
  12.     {
  13.         bool chk = 0;
  14.         for (int i = 0; i < 12; i++)
  15.             if (lt[i] == *curr)
  16.                 chk = 1;
  17.         if (!prev && chk)
  18.         {
  19.             ans++;
  20.             prev = 1;
  21.         }
  22.         if (!chk)
  23.             prev = 0;
  24.         curr++;
  25.     }
  26.     return ans;
  27. }
  28.  
  29. int main(void)
  30. {
  31.     int n;
  32.     int arr[10000];
  33.     char s[1000001];
  34.     scanf("%d", &n);
  35.     for (int i = 0; i < n; i++)
  36.         scanf("%d ", &arr[i]);
  37.     for (int i = 0; i < n; i++)
  38.     {
  39.         fgets(s, 1000001, stdin);
  40.         if (syllablecnt(s) == arr[i])
  41.             fputs(s, stdout);
  42.     }
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement