#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char ch, text[50];
int i, length, count=0;
clrscr();
cout<<"Enter a text "<<endl;
gets(text);
cout<<"enter a character to be searched : ";
cin>>ch;
length = strlen(text);
for(i=0; i<=length-1; i++)
if (text[i] == ch)count++;
if(count)
cout<<endl<<ch<<" occurs "<<count<<" times ";
else
cout<<endl<<ch<<" does not exist in the text ";
getch();
return 0;
}