import math
def solution(str1, str2):
answer = 0
str1=str1.lower()
str2=str2.lower()
l1=[''.join(str1[i:i+2]) for i in range(len(str1)-1) if str1[i:i+2].isalpha()]
l2=[''.join(str2[i:i+2]) for i in range(len(str2)-1) if str2[i:i+2].isalpha()]
print(l1, l2)
ids=dict([(i,a) for a,i in enumerate(set(l1+l2))])
print(ids)
l1=sorted([ids[item] for item in l1])
l2=sorted([ids[item] for item in l2])
print(l1,l2)
p1=p2=0
both=[]
merge=[]
while p1<len(l1) and p2<len(l2):
if l1[p1]==l2[p2]:
both.append(l1[p1])
merge.append(l1[p1])
p1+=1
p2+=1
elif l1[p1]<l2[p2]:
merge.append(l1[p1])
p1+=1
else:
merge.append(l2[p2])
p2+=1
if p1<len(l1): merge+=l1[p1:]
if p2<len(l2): merge+=l2[p2:]
print(both, merge)
if not merge: return 65536
return math.floor(len(both)/len(merge)*65536)