#include <iostream>
using namespace std;

const int MAX_SIZE = 256;

int countOf(char[], char);
void inputString(char[], int);
char inputSymbol();

int main() {

	char string[MAX_SIZE];
	inputString(string, MAX_SIZE);
	char symbol = inputSymbol();	

	int count = countOf(string, symbol);
	cout << "'" << symbol << "' occures " << count << " time(s)." << endl;

	return 0;
}

void inputString(char string[], int limit) {

	cout << "Input a stirng (max" << limit << "): ";
	cin.getline(string, limit);

}

char inputSymbol() {

	char symbol;

	cout << "Input a symbol: ";
	cin >> symbol;

	return symbol;

}

int countOf(char string[], char symbol) {

	int count = 0;
	for(int i = 0; string[i] != '\0'; ++i) {
		if(string[i] == symbol) {
			++count;
		}
	}

	return count;
}
