题目
找出字母出现最多的字母
思路
用hash表
代码
def lettercount(s):
freq = {}
for p in s:
word = ''.join(c for c in p if c.isalpha())
if word:
freq[word] = 1 + freq.get(word,0)
max_word = ''
max_count = 0
for key,value in freq.items():
if value>max_count:
max_count = value
max_word = key
print(max_word)
print(max_count)