My issue
it is giving wrong answer for 6 out of 7 testcases. I am not able to understand what’s the problem in the logic of my code.
My code
t=int(input())
m=pow(10,9)+7
for _ in range(t):
n,k=map(int,input().split())
s=input()
res=1
vowels=['a','e','i','o','u']
vow=0
midlet=1
for i in range(n):
if s[i] in vowels:
vow+=1
if vow%(k+1)==0:
res=(res * midlet) % m
midlet=1
else:
midlet=1
else:
midlet+=1
print(res)
Problem Link: VOWMTRX Problem - CodeChef