Date and time formatting

Report a typo

You need to write a program that prints dates and times in a special format. Hours, minutes, and seconds are split by a colon, and day, month, and year are split by a slash. Take a look at the examples below.

You can read three numbers in a line this way:

val (a, b, c) = readLine()!!.split(' ')

// or since Kotlin 1.6

val (d, e, f) = readln().split(' ')

Sample Input 1:

23 59 59
12 12 2018

Sample Output 1:

23:59:59 12/12/2018

Sample Input 2:

1 2 3
4 5 2018

Sample Output 2:

1:2:3 4/5/2018
Write a program in Kotlin
fun main() {
// write your code here
}
___

Create a free account to access the full topic