A not very elegant working solution,
val a = msg.split("\s") // Split by space
a = Array(Preparado, para, cocinar...)
val n = a.size / 2 // Get halving point rounded to lower closest integer
n = 1
val b = Array(a.take(n).mkString, a.drop(n).mkString(" ")) // Halve the array
b = Array(Preparado, para cocinar...)
b.foreach(println) // Print it
Preparado
para cocinar...
Update
As pointed out by @AdrienAubel, consider the use of splitAt
over the split array,
val (b1,b2) = a.splitAt(n)
b1 = Array(Preparado)
b2 = Array(para, cocinar...)
println(b1.mkString(" "))
Preparado
println(b2.mkString(" "))
para cocinar...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…