Problem Code - CV
Link - https://www.codechef.com/problems/CV
The Example Input fails to give correct output , ( output for ‘abu’ gives 2 instead of 1 ).
What’s wrong with the code , PLS HELP.
#include<bits/stdc++.h>
int main()
{
int t;
std::cin>>t;
for(int i=0;i<t;i++)
{
int vowels[] = {97,101,105,111,117};
int n_letters , count=0;
std::cin>>n_letters;
char letters[n_letters];
for(int j=0;j<n_letters;j++)
{
std::cin>>letters[j];
}
for(int j=0;j<n_letters;j++)
{
for(int k=0;k<(sizeof(vowels)/sizeof(int));k++)
{
if((int(letters[j])!=vowels[k]) && letters[j+1]==vowels[k])
{
count++;
}
}
}
std::cout<<"\n"<<count<<"\n";
}
std::cout<<"\n";
return 0;
}