Scally is writing a program that outputs words in a sentence in the reverse order: it transforms high blue skies to skies blue high. It is expected that the words contain only letters and are separated by space. Help Scally finish the program!
Strings
Reverse
Report a typo
Sample Input 1:
high blue skiesSample Output 1:
skies blue highWrite a program in Scala 3
object WordsReverser extends App {
val input = scala.io.StdIn.readLine()
val result = input.reverse.split(???).map(w => w.reverse).mkString(???)
println(result)
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.