Looking for cool bands

Report a typo

Your friend gave you a long list of musical bands, and among those, you want to find all bands with a certain word in their names.

Write a function findBands(), which gets List<String> or Set<String> from input, chooses only the bands with the input word (case-insensitive) in their names, and returns a list of those names.

Sample Input 1:

Sugar, Radiohead, Cage The Elephant, Sugar Ray, Metallica, Chemical Brothers, Sugar
sugar

Sample Output 1:

[Sugar, Sugar Ray, Sugar]
[Sugar, Sugar Ray]
Write a program in Kotlin
fun main() {
val listOfDishes = readln().split(", ").toList()
val setOfDishes = listOfDishes.toSet()
val keyWord = readln()

println(findBands(listOfDishes, keyWord))
println(findBands(setOfDishes, keyWord))
}

// Write here function findBands()
___

Create a free account to access the full topic