My issue
My hidden test case is failing, but the sample test case is passed.
What I did was, I kept a counter, which increments, when the scanned char is vowel. After that, I have kept an only if, which prints no if the count is >4
All this inside an for loop.
Please help
My code
#include <stdio.h>
#include<string.h>
int is_vowel(char c)
{
return c=='a' || c=='e' || c=='i' || c=='o' || c=='u' ;
}
int main()
{
int n;
int t;
char s[100];
scanf("%d",&n);
while(n--)
{
scanf("%d",&t);
scanf("%s",s);
int count=0;
for(int i=0;i<=t;i++)
{
if(strchr("aeiou",s[i])==NULL)
{
count++;
}
else
{
count+=0;
}
if(count>4)
{
printf("NO\n");
break;
}
}
if(count<=4)
{
printf("YES\n");
}
}
return 0;
}
Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/EZSPEAK