#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string word = "";
do
{
cout << "Enter a word that has at least 5 characters: " << endl;
cin >> word;
}while(word.size() < 5);
char searchCh = '0';
cout << "Enter a character and the program will tell you how many times it appears in the word " << word << "." << endl;
cin >> searchCh;
for(int i = 0; i < (int)word.size(); i++)
{
char ch = word.at(i);
if(searchCh == ch)
{
counter++;
}
}
cout << "The number of " << searchCh << "'s in the word " << "is " << counter << ".\n";
return 0;
}