I am not very familiar with coding and I am trying to solve the following:
Input:
{name, John, John Doe, Doe}
Output:
{name, John Doe}
So, it should delete {John, Doe} only if there is a string which contains already both of them.
I would be very grateful for any help! Thank you very much!