original: #tag1 #tag2 #tag3 #tag1 keeping only the last one: #tag2 #tag3 #tag1 keeping only the first one: #tag1 #tag2 #tag3