BrowserUk,
Sorry - see the 3rd assumption.
The number of letters in common is the exact number of unique letters in common. A 't' would only be counted once even if it existed twice in both the mystery word and the hint word
dukes has 5 letters in common with dukes
krems has 3 letters in common with seams
makes has 3 letters in common with seams
pokes has 35 letters in common with pokes
I didn't finish the list as you can see you have a flaw in your code (which I am interested in seeing).