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 backFromTheWall contains the names of all those who returned. Both checklists are already initialized as arrays.

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

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

Sample Input 1:

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

Sample Output 1:

true

Sample Input 2:

Jon Snow, Benjen Stark, Samwell Tarly, Gared Tuttle
Samwell Tarly, Gared Tuttle

Sample Output 2:

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


}
___

Create a free account to access the full topic