nick34992
4/7/2017 - 4:20 PM

Python: Dictionary: collections.defaultdict(int)

Python: Dictionary: collections.defaultdict(int)

from collections import defaultdict

s = 'mississippi'
d = defaultdict(int)

for k in s:
    d[k] += 1

d.items()