Back to the Problem
Frequency-count, then take the alphabetically smallest among the maxima.
Complexity: O(|S|)