Application

Report a typo

The Resistance is organizing ships to confront the Empire. R2D2, a droid loyal to Luke Skywalker, using its AI needs to find out the total ammunition of the ships whose name begins with T and which have more than 20 ammunition units, as they will be the first to fight in combat.

Sample Input 1:

XWing-100 YWing-200 TWing-50 TIEFighter-150

Sample Output 1:

200
Write a program in Kotlin
data class Ship(val name: String, val ammunition: Int)

fun main() {
val ships = readln().split(" ")
val shipsList = ships.map { Ship(it.split("-")[0], it.split("-")[1].toInt()) }

// write your code here
val res =


println(res)
}
___

Create a free account to access the full topic