Added defaultdict and changed isPermutationHash to more closely match book answer