adds NSMutableDictionary code to check for duplicates for problem 23