Write a program that displays which character appears most often (switch /M ) or least often (/L) in the standard input.

How to Write a program that displays which character appears most often (switch /M ) or least often (/L) in the standard input. The default is /M.


Remark:
The number of occurrences of all characters could be kept in an array of counters :
int allChars[256];
The numerical value of a character should be used as an index to the array.
int c;
…..
To undate the value of a counter for the character from the variable c
allChars[c]=allChars[c]+1;
or
allChars[c]++;
to search the array of counters you can use the code snippet:
int k;
for (k=0; k<sizeof(allChars)/sizeof(int); k++)
{
………………
}

This Program is Currently Not Available and If You Have The Program Code You Can Send Us.


Learn More :