# Help me in solving EZSPEAK problem

### My issue

Actually my code is correct and i have excuted it in several platforms and its giving me correct utput but i dont know in code chak my 2nd test case is failing can you solve this issue

### My code

``````# cook your dish here
t= int(input())
for _ in range(t):
N= int(input())
S =input()
count =0
vowels ='aeiou'
for i in S:
if i in vowels:
break
else:
count = count +1

if count>=4:
print('NO')
else:
print("YES")

``````

Problem Link: EZSPEAK Problem - CodeChef

@dhanvi_21 There seems to be a logical error in your code.

Consider the test case; crunchy, here your code will check until it finds a vowel and will break from the for loop and gives output YES as c would have been equals to 3.

But it has four letters in a row without a vowel in between; cr-u-nchy which should produce output NO.

Here is my code for reference.

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

``````

You can use regex to identify consecutive consonants.
Here is my code:

``````import re
T = int(input())
while(T!=0):
N = int(input())
S = input()
Found = re.search("(?:(?![aeiou])[a-z]){4,}", S)
if Found:
print("NO")
else:
print("YES")
T -= 1
``````

Thank you

Thank you !!

Still giving error

@dhanvi_21
Hi , U have made one logical mistake . U have to take the maximum length of all the substrings having all consonants in a row.
I have updated your code a bit that will take the maximum length of all the counts and then store it in maxcount variable.
After that we will compare the maxcount variable.
here is your updated code. Hope U will get it.

``````# cook your dish here
t= int(input())
for _ in range(t):
N= int(input())
S =input()
count =0
maxcount=0;
vowels ='aeiou'
for i in S:
if i in vowels:
if maxcount < count:
maxcount=count
count=0
else:
count = count +1
if maxcount <count:
maxcount=count
if maxcount>=4:
print('NO')
else:
print("YES")
``````