text: # https://pymotw.com/3/collections/counter.html
  # 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.
  import collections
  
  # initializing
  print(collections.Counter(['a', 'b', 'c', 'a', 'b', 'b']))
  print(collections.Counter({'a': 2, 'b': 3, 'c': 1}))
  print(collections.Counter(a=2, b=3, c=1))
  
  # update
  c = collections.Counter()
  print('Initial :', c)
  
  c.update('abcdaab')
  print('Sequence:', c)
  
  c.update({'a': 1, 'd': 5})
  print('Dict    :', c)
  
  # access
  c = collections.Counter('abcdaab')
  
  for letter in 'abcde':
      print('{} : {}'.format(letter, c[letter]))  # can be unknown key
  print(list(c.elements()))
  print(list(c.most_common(2)))
  
  # arithmetic
  c1 = collections.Counter(['a', 'b', 'c', 'a', 'b', 'b'])
  c2 = collections.Counter('alphabet')
  
  print('C1:', c1)
  print('C2:', c2)
  
  print('\nCombined counts:')
  print(c1 + c2)
  
  print('\nSubtraction:')
  print(c1 - c2)
  
  print('\nIntersection (taking positive minimums):')
  print(c1 & c2)
  
  print('\nUnion (taking maximums):')
  print(c1 | c2)
  