My issue
find the error
My code
#include <stdio.h>
#include <string.h>
int is_easy_to_pronounce(char *S, int l) {
int consecutive_consonants = 0;
const char vowels[] = "aeiou";
for (int i = 0; i < l; i++) {
if (strchr(vowels, S[i]) != NULL) {
consecutive_consonants = 0;
} else {
consecutive_consonants++;
if (consecutive_consonants >= 4) {
return 0;
}
}
}
return 1;
int main() {
int k;
scanf("%d", &k);
while (k--) {
int l;
char S[101];
scanf("%d", &l);
scanf("%s", S);
if (is_easy_to_pronounce(S, l)) {
printf("YES\n");
} else {
printf("NO\n");
}
}
return 0;
}
}
Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/EZSPEAK