Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Sorted twice solution in Clear category for Most Wanted Letter by Sioul
def most_wanted(text: str) -> str:
text = text.lower()
# only keep letters, remove duplicates, and sort alphabetically
l = sorted(set(e for e in text if e.isalpha()))
# sort by frequence (sort is stable so alphabetical order is kept if same frequence)
l = sorted(l, key=text.count, reverse=True)
return [e for e in l if text.count(e) == text.count(l[0])]
Oct. 19, 2019