pyassistant

Most Frequent Character

Given a string s, return the character that appears most frequently. If multiple characters are tied for the highest frequency, return the lexicographically smallest character among them. Treat characters as case-sensitive (i.e., 'A' and 'a' are different). If the input string is empty, return an empty string.

Example:

Input:
("abacbba",)
Output:
"a"

Make sure you return your solution, don't print!

AI

Bot

Trying to solve my challenge? Ask if you must, or press the purple button so I can analyze your code.