# Help me in solving EZSPEAK problem

### My issue

Why my soln is wrong if it is successfully executing against given input

for t in range(int(input())):
n = int(input())
s = input()
v = [‘a’,‘e’,‘i’,‘o’,‘u’]
f = ‘’
for l in s:
if l not in v:
f += l
elif l in v:
break
if len(f) >= 4:
print(‘NO’)
else:
print(‘YES’)

### My code

``````# cook your dish here
for t in range(int(input())):
n = int(input())
s = input()
v = ['a','e','i','o','u']
f = ''
for l in s:
if l not in v:
f += l
elif l in v:
break
if len(f) >= 4:
print('NO')
else:
print('YES')

``````

Problem Link: EZSPEAK Problem - CodeChef

@deverath_1
i have corrected it in your code ,hope u will get it.

``````# cook your dish here
for t in range(int(input())):
n = int(input())
s = input()
v = ['a','e','i','o','u']
f = 0
for l in s:
if l not in v:
f += 1
elif l in v:
if f>=4:
break
else:
f=0
if f >= 4:
print('NO')
else:
print('YES')
``````
1 Like

for(int i=0;i<t;i++){
int c=0;
for(int j=0;j<n;j++){
if(s.charAt(j)!=‘a’ && s.charAt(j)!=‘e’ && s.charAt(j)!=‘i’ && s.charAt(j)!=‘o’ && s.charAt(j)!=‘u’){
c++;
}
else{
c=0;
}
if(c>=4){
System.out.println(“NO”);
break;
}
}
if(c!=4){
System.out.println(“YES”);
}