# -*- coding: utf-8 -*-
# collections4.py

import collections as cln

mytext = 'collections'
lmytext = list(mytext)
print(lmytext)
freq = cln.Counter(lmytext)
print(freq)

#----------------------------------------
f = open(r'D:\HWP\강의자료\파이썬\codes\BTS_Dynamite_lyrics.txt', 'r')
lyrics = f.readlines()
f.close()

mywords = ''.join(lyrics) # lyrics 가 리스트이므로 하나의 문자열로 변경

freq=cln.Counter(mywords.lower().split())
print(freq)

#---------------------

cc = cln.Counter({'red':4,  'blue':3})
print("cc: ", list(cc.elements()))

dd = cln.Counter(red=3, blue=4)
print("dd: ", list(dd.elements()))  

ee = dd + cc 
print("dd+cc: ", dd + cc)
print("dd-cc: ", dd - cc)
ee.subtract(dd)
print(ee)