Remove duplicates from a String Inspired by this unassuming StackOverflow question.
The idea is simple; given a String and an array of Strings, remove any instances of words in the array (ignoring case) from the input String other than the first, along with any additional whitespace this may leave. The words must match entire words in the input String, and not parts of words.
e.g. &quot;A cat called matt sat on a mat and wore a hat A cat called matt sat on a mat and wore a hat&quot;, [&quot;cat&quot;, &quot;mat&quot;] should output &quot;A cat called matt sat on a mat and wore a hat A called matt sat on a and wore a hat&quot;
Input

Input can be taken as either a String, and an array of Strings or an array of Strings where the input String is the first element. These parameters can be in either order.
The input String may not be taken as a list of space-delimited Strings.
The input String will have no leading, trailing or consecutive spaces.
All input will only contain characters [A-Za-z0-9] with the exception of the input String also including spaces.
The input array may be empty or contain words not in the input String.

Output

The output can either be the return value from a function, or printed to STDOUT
The output must be in the same case as the original String

Test cases
the blue frog lived in a blue house, [blue] -&gt; the blue frog lived in a house
he liked to read but was filled with dread wherever he would tread while he read, [read] -&gt; he liked to read but was filled with dread wherever he would tread while he
this sentence has no matches, [ten, cheese] -&gt; this sentence has no matches
this one will also stay intact, [] -&gt; this one will also stay intact
All the faith he had had had had no effect on the outcome of his life, [had] -&gt; All the faith he had no effect on the outcome of his life
5 times 5 is 25, [5, 6] -&gt; 5 times is 25
Case for different case, [case] -&gt; Case for different
the letters in the array are in a different case, [In] -&gt; the letters in the array are a different case
This is a test Will this be correct Both will be removed, [this,will] -&gt; This is a test Will be correct Both be removed

As this is code golf, lowest byte count wins!
R, 84 bytes



function(s,w,S=el(strsplit(s," ")),t=tolower)cat(S[!duplicated(x&lt;-t(S))|!x%in%t(w)])


Try it online!

Less than 100 bytes on a string challenge that's not also kolmogorov-complexity?

Explanation:

After we break up the string into words, we need to exclude those that are


duplicates and
in w


or alternatively, turning that on its head, keeping those that are


the first occurrence of a word OR
not in w.


duplicated neatly returns logical indices of those that are not the first occurrence, so !duplicated() returns indices of those which are first occurrences, and x%in%w returns logical indices for x of those which are in w. Neat.