C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#define MAX_SIZE 100 // Maximum string size
#define MAX_CHARS 255 // Maximum characters allowed
int main()
{
char str[MAX_SIZE];
int freq[MAX_CHARS]; //Stores frequency of each character
int i = 0, min, min2;
int ascii;
printf("Enter any string: ");
gets(str);
/* Initialize frequency of all characters to 0 */
for(i=0; i<MAX_CHARS; i++)
{
freq[i] = 0;
}
/* Finds frequency of each characters */
i=0;
while(str[i] != '\0')
{
ascii = (int)str[i];
freq[ascii] += 1;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run