JavaScript (ES6), 6389
The hash function (105 bytes):
s=>[...s.replace(/[A-Z]/g,a=>(b=a.toLowerCase())+b+b)].reduce((a,b)=>(a<<3)*28-a^b.charCodeAt(),0)<<8>>>8
The scoring function (NodeJS) (170 bytes):
h={},c=0,l=require('fs').readFileSync(process.argv[2],'utf8').split('\n').map(a=>h[b=F(a)]=-~h[b])
for(w of Object.getOwnPropertyNames(h)){c+=h[w]>1&&h[w]}
console.log(c)
Call as node hash.js dictionary.txt
, where hash.js
is the script, dictionary.txt
is the dictionary text file (without the final newline), and F
is defined as the hashing function.
Thanks Neil for shaving 9 bytes off the hashing function!