SHARE
TWEET

Untitled

a guest Nov 12th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int checkvowel(char*, char );
  3. int checkletter(char );
  4. int main(void) {
  5.     int n, count = 0, cvow = 0;
  6.     scanf("%d", &n);
  7.     char vowel[13] = "aeyuioAEYUIO";
  8.     int num[n];
  9.     char c;
  10.     char strin[101] = "\0";
  11.     for (int i = 0; i < n; i++) {
  12.         scanf("%d", &num[i]);
  13.     }
  14.     for (int i = 0; i < n; i++) {
  15.         scanf("%c", &c);
  16.         if ((c != '\n') && (c != '\0')) {
  17.             strin[0] = c;
  18.         }  
  19.         else {
  20.             scanf("%c", &strin[count]);
  21.         }
  22.         do {
  23.             if (checkletter(strin[count])) {
  24.                 if (checkvowel(vowel, strin[count])) {
  25.                     if ((count == 0) || ((count != 0) &&
  26.                         (checkvowel(vowel, strin[count - 1]) == 0)))
  27.                             cvow++;
  28.                 }
  29.             }
  30.             count++;
  31.             scanf("%c", &strin[count]);
  32.         } while ((strin[count] != '\0') && (strin[count] != '\n'));
  33.         if (cvow == num[i]) {
  34.             for (int j = 0; j < count + 1; j++) {
  35.                 printf("%c", strin[j]);
  36.             }
  37.         }
  38.         cvow = 0;
  39.         count = 0;
  40.     }
  41.     return 0;
  42. }
  43. int checkvowel(char *vowel, char a) {
  44.     for (int j = 0; j < 12; j++) {
  45.         if (a == vowel[j]) {
  46.             return 1;
  47.         }
  48.     }
  49.     return 0;
  50. }
  51. int checkletter(char a) {
  52.     if (((a >= 'a') && (a <= 'z')) || ((a >= 'A') && (a <= 'Z')))
  53.         return 1;
  54.     return 0;
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top