import collections
print(collections.Counter(['a', 'b', 'c', 'd', 'a', 'c']))

c = collections.Counter()
print('initilize ', c)
c.update('abcdaab')
print('sequece', c)
c.update({'a':1, 'd':5})
print('Dict :',c)

"""
Explanation: A Counter is a container that keeps track of how many times equivalent values are added. It can be used to implement the same algorithms for which other languages commonly use bag or multiset data structures.
Initilizing
End of explanation
"""


c = collections.Counter('abcdaab')
for letter in 'abdce':
    print('{}:{}'.format(letter, c[letter]))

c = collections.Counter('extremely')
c['z'] = 0
print(c)
print(list(c.elements()))

"""
Explanation: Accessing Counts
End of explanation
"""


import collections
c1 = collections.Counter(['a','b', 'c', 'a', 'b', 'b'])
c2 = collections.Counter('alphabet')
print('C1:', c1)
print('C2:', c2)
print('\n Combined counts')
print(c1+c2)
print('\n subtractions')
print(c1-c2)
print('\n Interaction')
print(c1 & c2)
print('\n union')
print(c1 | c2)

"""
Explanation: Arithmetic
End of explanation
"""


