Get the maximum occurrence of the character in the string with example in C

Here Input string = “test string for testing”

Construct the character count array from the input string.

iCount[‘e’] = 2
iCount[‘s’] = 3
iCount[‘t’] = 5
iCount[‘r’] = 2
iCount[‘i’] = 2
iCount[‘f’] = 1
iCount[‘o’] = 1
iCount[‘f’] = 1
iCount[‘n’] = 2
iCount[‘g’] = 1

In the above array, we can get the maximum number is ‘5’ that is ‘t’

Recommended Tutorials for this example is: