Problem specifies no duplicates can match. Added duplicate check.