FREQUENCY OF CHARACTERS

Description:

Find the Frequency of Characters in a string Refer Sample Input and Output. Input 1: india b Output 1: 0 Input 2: srmuniversity s Output 2: 2 Test Case 1 Input (stdin) india i Expected Output 2 Test Case 2 Input (stdin) Chennai n Expected Output 2

Program :

#include <iostream>

#include<string.h>

using namespace std;

int main()

{

char s[30],ch;

  int i,m=0;

  cin>>s>>ch;

  for(i=0;i<strlen(s);i++)

  {

  if(s[i]==ch)

    m++;

  }

  cout<<m;

return 0;

}