41 lines
675 B
C
41 lines
675 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
|
|
|
|
int isVocal(char c) {
|
|
char * vowels = "aeiou";
|
|
|
|
c = tolower(c);
|
|
return strchr(vowels, c) != NULL;
|
|
}
|
|
|
|
void countAndPrint(char str[], int n) {
|
|
int l = strlen(str), v, s = 0;
|
|
|
|
for (int i = 0; i < l - n; i++) {
|
|
v = 0;
|
|
for (int j = i; j < i + n; j++) {
|
|
if (isVocal(str[j])) {
|
|
v++;
|
|
}
|
|
}
|
|
|
|
if (v == 2) {
|
|
s++;
|
|
for (int j = i; j < i + n; j++)
|
|
putchar(str[j]);
|
|
|
|
putchar('\n');
|
|
}
|
|
|
|
}
|
|
|
|
printf("%d", s);
|
|
}
|
|
|
|
int main() {
|
|
countAndPrint("forExample",4);
|
|
return 0;
|
|
}
|