Returns the position of the first occurrence of a vowel in the given string s. There are only five vowels in English: 'a', 'e', 'i', 'o', and 'u'.
Returns 0 if there are no vowels in the string.
Only lowercase cases are considered.
Returns 0 if there are no vowels in the string.
Only lowercase cases are considered.
sample input
and
Sample output
1
Code:
#include <iostream> #include <string> using namespace std; intmain() { string s; cin >> s; int len = s.length(); for(int i = 0; i < len; i++) { if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') { cout << i+1; return 0; } } cout << 0; return 0; }