Help the Lord Commander

Report a typo

The Lord Commander of the Night’s Watch wants to know if anyone is patrolling beyond the Wall. He has two checklists from the guards: beyondTheWall lists all who went beyond the Wall, and backToTheWall contains the names of all those who returned. Both checklists are already initialized as lists.

Help the Lord Commander to check whether anyone is currently on patrol. If there is no one beyond the Wall, the output should be true; otherwise, false.

Tip: If a watchman is back, his name will be on both lists. That is, if all the scouts have returned, the lists must match.

The order of lists doesn't matter.

Sample Input 1:

Benjen Stark, Alliser Thorne, Jeor Mormont
Benjen Stark, Alliser Thorne, Jeor Mormont

Sample Output 1:

true
Write a program in Kotlin
fun main() {
val beyondTheWall = readLine()!!.split(", ").map { it }.toMutableList()
val backToTheWall = readLine()!!.split(", ").map { it }.toMutableList()
// do not touch the lines above
// write your code here


}
___

Create a free account to access the full topic