Adding arrays

Report a typo

Concatenate two arrays firstArray and secondArray and print the result.

In the example below, each line corresponds to a separate array. 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 firstArray = readLine()!!.split(' ').map { it }.toTypedArray()
val secondArray = readLine()!!.split(' ').map { it }.toTypedArray()
// do not touch the lines above
// write your code here

}
___

Create a free account to access the full topic