”a”, ”e”, ”i”, ”o”, and ”u” are called vowels. word is a variable of type string.
Assume that a word is read from the keyboard and assigned to this variable. Write a
for loop to count the number of vowels in a word. Only write the for loop. Those who
write more than required number of lines, are going to lose points.
#include <iostream>
#include <string>
int main() {
const std::string vowels = "aeiou";
std::string input;
std::cin >> input;
int counter = 0;
for (size_t i = 0; i < input.size(); i++) {
counter += vowels.find(input[i]) != std::string::npos;
}
std::cout << counter;
return 0;
}