The algorithm could search through the inputs and treat only the *unique* entries. Currently it processes *all* entries, even if they are duplicates.