My issue
output is coming
yes
no
yes
yes
yes
instead of
yes
no
yes
no
yes
My code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int T,i,N,j,count=0,k=0,flag =0;
string S;
vector<int>D;
cin>>T;
for(i=0;i<T;i++)
{
cin>>N;
D.resize(N);
cin>>S;
for(j=0;j<N;j++)
{
if(S[j]!='a'&&S[j]!='e'&&S[j]!='i'&&S[j]!='o'&&S[j]!='u')
{
count+=1;
}
else
{
D[k] = count;
count = 0;
k=k+1;
}
}
if(count == N && N>=4)
{
flag = 1;
goto label;
}
for(j=0;j<=k+1;j++)
{
if(D[j]>=4)
{
flag = 1;
}
}
label:
if(flag == 1)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
flag=0;
k=0;
}
return 0;
}
Problem Link: EZSPEAK Problem - CodeChef