https://programmers.co.kr/learn/courses/30/lessons/17677
from collections import Counter
def solution(str1, str2):
arr1=[]
arr2=[]
for i in range(0,len(str1)-1):
if(str1[i].isalpha() and str1[i+1].isalpha()):
arr1.append(str1[i].lower()+str1[i+1].lower())
for i in range(0,len(str2)-1):
if(str2[i].isalpha() and str2[i+1].isalpha()):
arr2.append(str2[i].lower()+str2[i+1].lower())
if not arr1 and not arr2:
return 65536
arr1=Counter(arr1)
arr2=Counter(arr2)
inter = list((arr1 & arr2).elements())
union = list((arr1 | arr2).elements())
answer=len(inter)/len(union)
return int(answer*65536)
from collections import Counter
Counter와 elements()
https://dongdongfather.tistory.com/70