Skip to content

Instantly share code, notes, and snippets.

@varshneydevansh
Created March 3, 2018 06:33
Show Gist options
  • Save varshneydevansh/b8a98948a67c83a8168428304694db46 to your computer and use it in GitHub Desktop.
Save varshneydevansh/b8a98948a67c83a8168428304694db46 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main()
{
string S;
cin>>S;
int L=S.size(); //Calculating and storing the size of S
int cnt = 0; //This will contain the number of vowels in S
for(int i=0; i<L; i++){
/*If we find the character at ith index to be a vowel increase cnt by 1!*/
if(S[i]=='A' || S[i]=='E' || S[i]=='I' || S[i]=='O' || S[i]=='U')cnt++;
}
cout<<cnt<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment