Cut the collection

Report a typo

In two lines of input, you have a collection with a few elements and one word, respectively. Write a function dropElements(), which drops all the occurrences of that word from the collection and returns a new list.

Sample Input 1:

pancakes eggs waffles sausages eggs bacon vegetables eggs muffins crumpets toast eggs
eggs

Sample Output 1:

[pancakes, waffles, sausages, bacon, vegetables, muffins, crumpets, toast]
[pancakes, waffles, sausages, bacon, vegetables, muffins, crumpets, toast]
Write a program in Kotlin
fun main() {
val originalList = readln().split(" ")
val originalSet = originalList.toSet()
val word = readln()

println(dropElements(originalList, word))
println(dropElements(originalSet, word))
}

// Write function dropElements() here
___

Create a free account to access the full topic