Guard On The Gate

Report a typo

You need to help the guard who is watching the main gate leading to the wilderness beyond the Wall. It is his responsibility to put everyone who gets through the gate on the checklist backToTheWall.

Add the name of the watchman (stored in the returnedWatchman variable) to the list backToTheWall and print the result with joinToString().

Sample Input 1:

Benjen Stark, Samwell Tarly, Gared Tuttle
Jon Snow

Sample Output 1:

Benjen Stark, Samwell Tarly, Gared Tuttle, Jon Snow
Write a program in Kotlin
fun main() {
val backToTheWall = readLine()!!.split(", ").map { it }.toMutableList()
val returnedWatchman = readLine()!!
// do not touch the lines above
// write your code here

}
___

Create a free account to access the full topic