Most Frequent Character
Medium · Strings
Write a function mostFrequentChar that returns the character that appears most often in a non-empty string. The check is case-sensitive.
If several characters share the highest count, return the one that appears first in the string.
Next: Second Largest Number