哈希表、集合
一、哈希表
统计出现次数最多的单词
1. counter
import collections
if __name__ == '__main__':
word_list = ['a', 'b', 'a', 'c', 'd', 'e', 'f']
print(collections.Counter(word_list).most_common(1)[0][0])
word_str = 'abcdeaascebd'
print(collections.Counter(word_str).most_common(1)[0][0])
2. 循环+hash
二、集合