Odpowiedź:
#include <iostream>
#include <string>
#include <sstream>
int main() {
std::string text = "Ania ma psa, kota autograf i ananas";
std::istringstream textStream(text);
int counter = 0;
for(std::string word; textStream >> word;){
if(std::tolower(word.front()) == 'a'){
counter++;
}
}
std::cout << "W tekscie wyrazow na litere a jest: " << counter;
return 0;
}
Wyjaśnienie:
Dałem, że może to być zarówno małe jak i duże a