https://www.devskill.com/CodingProblems/ViewProblem/439
#include<iostream>
#include<cstring>
using namespace std;
bool IsVowel(char c)
{
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
{
return true;
}
else
return false;
}
int main()
{
int t,n;
cin>>t;
for(int j=1;j<=t;j++){
cin>>n;
string s;
cin>>s;
int count=0;
bool ok=false;
for(int i=0;i<n;i++)
{
if(IsVowel(s[i]))
{
ok=true;
}
else
{
if(ok==true){
count++;
ok=false;
}
}
}
if(ok==true)
{
count++;
}
cout<<"Case "<<j<<": ";
cout<<count<<endl;
}
}
No comments:
Post a Comment