Помогите решить задачу на С++
Определить, сколько в тексте слов, начинающихся на
букву а или я.
По дате
По рейтингу
123456789101112131415161718192021
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main() {
system("chcp 1251 > nul");
cout << "Текст: ";
string text;
getline(cin, text);
istringstream iss(text);
string letters{ "ая" };
auto count = 0U;
string word;
while (iss >> word) {
if (letters.find(word.front()) != string::npos) {
++count;
}
}
cout << "Количество: " << count << '\n';
system("pause > nul");
}