Harry and the Spell Power

Report a typo

Harry Potter is learning different spells. He has a list of spells with their power values. He wants to know only the name of the spells with the power greater than or equal to 40. Could you help him?

Sample Input 1:

expetum-98 patronus-23 Axio-89 lithigum-23 madriketom-76

Sample Output 1:

[expetum, Axio, madriketom]
Write a program in Kotlin
data class Spell(val name: String, val power: Int)

fun main() {
val input = readln().split(" ")
val spells = input.map { Spell(it.split("-")[0], it.split("-")[1].toInt()) }

// write your code here
val res =

println(res)
}
___

Create a free account to access the full topic