Hassaan
11/07/2023, 1:15 PMval lines = readln().split("\\s+".toRegex()).map { it }.toMutableList()
println(lines.joinToString(" , "))
Ronny Bräunlich
11/07/2023, 1:41 PMreadln()
is a bad choice because as the doc states, it terminates upon LF/CRLF. Therefore, you either have to read the lines in a loop or use something like
val scanner = Scanner(System.`in`)
val readText = scanner.nextLine()
Klitos Kyriacou
11/07/2023, 2:37 PMHassaan
11/07/2023, 2:38 PMKlitos Kyriacou
11/07/2023, 3:03 PMval lines = System.`in`.reader().readLines()