cswork / OA打开练习工作台

其他OA #16

Most Unknown Elements (Part 3 :)

简单可在线判题

考点(AI 标注)哈希计数字符串

Compute the Jaccard similarity of character multisets. The source's example shows that repeated characters count and gives 0.4; this site adds non-empty strings and the standard input protocol.

输入格式

Two lines with non-empty strings containing only lowercase English letters, each of length 1..10^5.

输出格式

Output the multiset Jaccard similarity: Σmin(countA[c],countB[c]) / Σmax(countA[c],countB[c]), with an error of at most 1e−6.

样例 1

输入:

baa
abbc

输出:

0.400000000000

样例 2

输入:

abc
xyz

输出:

0.000000000000

样例 3

输入:

aaaa
aa

输出:

0.500000000000