/*
2. Write a program to read a character C and then a 
string S and to display how many times C appears in S.
*/

#include<iostream>
#include <string>
using namespace std;
int main()
{
	int i, n, count = 0;
	string s;
	char c;
	cout << "Enter a string: " << endl;
	getline(cin,s);
	cout << "Enter a character: ";
	cin >> c;
	n= s.size();
	i = 0;
	while (i < n)
	{
		if (s[i] == c)
			count++;
		i++;
	}
	cout << c << " appears " << count
		<< " times in " << s << "." << endl;
	return 0;
}    
