# Find the most frequent alphabet appearing in the given string. In case letter with same frequency, choose the one which comes first alphabetically

This is the desired result which I want:

• You could use an associative array in which the keys are the alphabet, in order, and the values start with $0$ and get increased with each new occurrence of the corresponding letter. After the input has been processed, go over the array keeping the position with maximum value so far and only updating if a new position appears with an strictly larger value.
– plop
Feb 27 '21 at 15:40