Mathematica, 84 bytes
(x="war""peace")(y="freedom""slavery")(z="ignorance""strength")/#/.x->1/.y->1/.z->1&
Explanation
More "arithmetic" with strings! As in the linked answer, this is based on the fact that you can "multiply" strings in Mathematica which will leave them unevaluated (similar to multiplying two unassigned variables x*y
), but that Mathematica will apply basic simplifications, like cancelling factors in a division.
So we start by storing the three pairs as products in x
, y
, z
, respectively and multiply them all together:
(x="war""peace")(y="freedom""slavery")(z="ignorance""strength")
This evaluates to
"freedom" "ignorance" "peace" "slavery" "strength" "war"
(Mathematica automatically sorts the factors, but we don't care about the order.)
We divide this by the input to remove the word we don't want with .../#
, since Mathematica cancels the factors. E.g. if the input was "peace"
we'd end up with:
"freedom" "ignorance" "slavery" "strength" "war"
Finally, we get rid of the pairs we're not interested in, by substituting each of x
, y
and z
with 1
. Again, Mathematica's simplification kicks in that 1*a
is always a
. This part is done with:
/.x->1/.y->1/.z->1
The nice thing is that Mathematica knows that multiplication is Orderless
so this will find the two factors regardless of whether they're adjacent in the product or not. Only the word that is opposite to the input is no longer paired in the product, so that one won't be removed and remains as the sole output.
w p f s i
) are not found anywhere else in any of the words. An intriguing property. \$\endgroup\$