I have a list of strings such as:
myList = ["paper", "Plastic", "aluminum", "PAPer", "tin", "glass", "tin", "PAPER", "Polypropylene Plastic"]
I want this outcome (and this is the only acceptable outcome):
myList = ["paper", "Plastic", "aluminum", "tin", "glass", "Polypropylene Plastic"]
Note that if an item ("Polypropylene Plastic"
) happens to contain another item ("Plastic"
), I would still like to retain both items. So, the cases can be different, but the item must be a letter-for-letter match, for it to be removed.
The original list order must be retained. All duplicates after the first instance of that item should be removed. The original case of that first instance should be preserved, as well as the original cases of all non-duplicate items.
I've searched and only found questions that address one need or the other, not both.