Adding lists

Report a typo

Concatenate two mutable lists firstList and secondList and print the result.

In the example below, each line corresponds to a separate list. Elements are separated by spaces.

Tip: Use the function joinToString().

Sample Input 1:

valar morghulis
valar dohaeris

Sample Output 1:

valar, morghulis, valar, dohaeris
Write a program in Kotlin
fun main() {
val firstList = readLine()!!.split(' ').map { it }.toMutableList()
val secondList = readLine()!!.split(' ').map { it }.toMutableList()
// do not touch the lines above
// write your code here

}
___

Create a free account to access the full topic