Explore
ProGrad Programs
About Us

Edit
Reply




Edit

Program to find the frequency of characters in a string | FACE Prep

Published on 11 Mar 2020

Program to find the frequency of characters in a string is discussed here. Given a string, the frequency of occurrence of each character is displayed as output.


Sample Input & Output:


Input: google


Output:

e 1

g 2

l 1

o 2


Algorithm to find the frequency of characters in a string


  • Input the string from the user.
  • Traverse the string, character by character and store the count of each of the characters in an array.
  • Print the array that contains the frequency of all the characters.


Program to find the frequency of characters in a string


C
C++
Java
Python 3

Output
Enter the string : face
f - 1
a - 1
c - 1
e - 1


Recommended Programs






If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in
Explore 'c'
Articles