What's wrong in this code VOWMTRX

it is showing RE (SIGSEGV) on two test cases and working fine with rest 7 test cases.

#include <bits/stdc++.h>
using namespace std;

using ll = long long int;

const ll mod = 1e9 + 7;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);

ll t;
cin>>t;
while(t--){
    ll n,k;
    cin>>n>>k;
    
    string s;
    cin>>s;
    
    vector<ll> v;
    
    ll count = 0;
    for(ll i=0; i<n; i++){
        if(s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u'){
            count++;
            if(count == k){
                count = 0;
                i++;
                ll in_between = 0;
                while(s[i] != 'a' && s[i] != 'e' && s[i] != 'i' && s[i] != 'o' && s[i] != 'u' && i<n){
                    in_between++;
                    i++;
                }
                if(i<n){
                    v.push_back(in_between+1);
                }
                i--;
            }
        }
    }
    
    // cout<<"vector : ";
    // for(int i=0; i<v.size(); i++){
    //     cout<<v[i]<<" ";
    // }
    // cout<<endl;
    
    int ans = v[0];
    for(int i=1; i<v.size(); i++){
        ans = ((ans%mod) * (v[i]%mod))%mod;
    }
    
    cout<<ans<<endl;
    
}
return 0;

}

So I tried doing some changes at the end of the code but then its showing WA for those two test cases. Following is the changes that I made:

if(v.size() > 0){
int ans = v[0];
if(v.size() > 1){
for(int i=1; i<v.size(); i++){
ans = ((ans%mod) * (v[i]%mod))%mod;
}
}

  cout<<(ans%mod)<<endl;

}
else{
cout<<“0”<<endl;
}

I am not sure , but maybe you are not checking i<n inside the while condition , so maybe in some test case i==n while doing I++ and you are checking s[i]. So you will get RE, try adding the condition and check.

I have checked the condition i<n in while loop, check again

You are getting RE in this TC:

1 1 
a

and also
write i<n first in while loop

No there was some mistake in printing the ans now i have corrected it, the while is fine i have written i<n in while loop