Hello. I would like to take an array of arguments and generate an output array that will group certain words together ONLY IF all of the words are together. Else, the output would just be the original arguments.
Ex.
i want to return "fruit" only if apple, orange, and banana are all present.
so
input: apple, orange, banana, grapes
output: fruit, grapes
input: apple, banana, grapes
output: apple, banana, grapes
However, I also only want it to use each argument only once
ex.
fruit = apple, orange, banana
tree fruit = apple, orange, banana, pineapple
input: apple, orange, banana, pineapple, grapes
output: tree fruit, grapes
NOT fruit, tree fruit, grapes
Any suggestions?
Bookmarks