I have put a general title for a good search, but my question is a bit more specific.

I have got one array:

```
var keywords= ["Anglo-Saxon English","American English","British English","Canadian English","Fast British English","Austrian German","American Football","British English","Fast British English","Blue Jeep","Hot Summer","Mild Summer","Hot Brazilian Summer"];

```

and another array:

```
var terms = ["english","english","english","english","english","german","football","british english","british english","jeep","summer","summer","summer"];

```

Every keyword corresponds to every term, as every keyword contains respective term in itself. For example, 'Anglo-Saxon English' keyword corresponds to 'english' term, 'American Football' keyword corresponds to 'football' term, etc. However, in keywords array there are some duplicates. In this example duplicate keywords are: 'British English' keywords which corresponds to 'english' term as well as 'british english' term, 'Fast British English' keywords which corresponds to 'english' term as well as 'british english' term. There can be any number of duplicates (I have put 2 for simplicity). All keywords has got their respective terms in the same order in the arrays, therefore length of both arrays is the same.

My question is how to leave only one lement among duplicates which has more specific corresponding term? For instance, 'british english' is more specific term than just 'english' therefore I want to remove 'British English' (keywords[2]) duplicate keyword with its respective term 'english' (terms[2]) from both arrays, and leave only 'British English' (keywords[7]) keyword with its term 'british english' (terms[7]).

UPDATE: With the solution offered by Tobos below, I came up with the working fiddle which is: <http://jsfiddle.net/ZqEhQ/>. However, here 'Fast British English' and 'British English' still get picked up by 'Languages' instead of being pichked up by 'Car' category which has got more specific 'british english' term versus just 'english' term of 'Languages'category. Any ideas?