Another idea that is different from all the valuable answers, I admit that the hash looks better, I just wanted to see it from a different angle.
I would sort all the words in each document and compare each document with each other.
For example, docA> brown, fox, jump; docB-> doc, jump, not docC-> dog, fox, jump
comparing them is like this
until there is a single document with words
get first element of documents
compare the most descending first element if that element exists more than once reserve it
throw the one that is the most descending (in my case)
therefore in the first comparison
docA → fox, jump docB → doc, jump, not docC → dog, fox, jump
in the second comparison
docA → fox, jump docB → jump, not docC → dog, fox
in the third comparison
docA → fox, jump docB → jump, not docC → fox, jump
reserve fox in the 4th comparison, reserve jump in the 5th comparison.