[Level 2] [1차] 뉴스 클러스터링

나며기·2021년 10월 3일
0

programmers

목록 보기
65/111
post-thumbnail
from collections import Counter

def solution(str1, str2):
    STR1 = Counter([(str1[i]+str1[i+1]).lower() for i in range(len(str1)-1) if (str1[i]+str1[i+1]).isalpha()])
    STR2 = Counter([(str2[i]+str2[i+1]).lower() for i in range(len(str2)-1) if (str2[i]+str2[i+1]).isalpha()])
    try:
        return int(len(list((STR1 & STR2).elements())) / len(list((STR1 | STR2).elements())) * 65536)
    except:
        return 65536
profile
PLUS ULTRA

0개의 댓글