From 3c75427a3e598d9f5c2ef8ebfea6c1212e412c7e Mon Sep 17 00:00:00 2001 From: gamjalee <68909554+gamjalee@users.noreply.github.com> Date: Sat, 2 Jul 2022 17:44:53 +0900 Subject: [PATCH] Add files via upload --- .../(P)17677/17677_py_jy.py" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "16\354\243\274\354\260\250/(P)17677/17677_py_jy.py" diff --git "a/16\354\243\274\354\260\250/(P)17677/17677_py_jy.py" "b/16\354\243\274\354\260\250/(P)17677/17677_py_jy.py" new file mode 100644 index 0000000..29050fe --- /dev/null +++ "b/16\354\243\274\354\260\250/(P)17677/17677_py_jy.py" @@ -0,0 +1,33 @@ +import math +a = 65536 + +def check(strr): + strr = strr.lower() + listt = [] + for i in range(len(strr) - 1): + if strr[i:i + 2].isalpha(): + listt.append(strr[i:i + 2]) + return listt + +def solution(str1, str2): + s1 = check(str1) + s2 = check(str2) + if s1 == [] and s2 == []: + return a + + s1_cp = s1.copy() + s2_cp = s2.copy() + + # 교집합 + join = [] + for i in s1: + if i in s2_cp: + join.append(i) + s1_cp.remove(i) + s2_cp.remove(i) + # 합집합 + union = join + s1_cp + s2_cp + answer = math.floor((len(join) / len(union)) * a) + return answer + +#print(solution("FRANCE", "french")) \ No newline at end of file