Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Counter + re solution in Clear category for The Most Wanted Letter by locky.spb
import collections
import re
def checkio(text: str) -> str:
Count = collections.Counter()
text = re.sub(r'[\W\d]', '', text.lower()) # replace all non-letters with ''
for sym in text:
Count[sym] +=1
sorted_list = sorted(Count.items(), key = lambda x : x[0], reverse = False ) #sort by key
sorted_list = sorted(sorted_list, key = lambda x : x[1], reverse = True ) # sort by value, max 1st
return sorted_list[0][0]
Sept. 30, 2019