I meant the latter, and your solution works well (see my 2nd reply to dragonchild above for some clarifications).
It also feels "right". The problem is when some char X appears in word2 and then twice in word1... Using a hash is a clever solution to this problem. I've been trying to run your algorithm on some examples, and in my head, and didn't break it yet.
It also works about 50% faster than my original version.