Counter는 파이썬의 내부 라이브러리인 collections안에 들어있는 함수로 개수를 셀 때, 유용하다.
x = "abc"
# Counter({'a':1, 'b':1, 'c':1})
Counter(x)
a = "aabcd"
# Counter({'a':2, 'b':1, 'c':1, 'd':1})
Counter(a)
b = "abbcccd"
# Counter({'a':1, 'b':2, 'c':3, 'd':1})
Counter(b)
# Counter({'a':1, 'b':1, 'c':1, 'd':1})
Counter(a) & Counter(b)
# Counter({'a':2, 'b':2, 'c':3, 'd':1})
Counter(a) | Counter(b)