📜  计算重复字符串映射python代码示例

📅  最后修改于: 2022-03-11 14:45:48.327000             🧑  作者: Mango

代码示例1
# Python 3+
import collections
collections.Counter(input_string) # The almost fastest
# Python 2
{key: string.count(key) for key in set(string)} # The second fastest