fun move_first_word_to_end_of_string(s: String): String {
val parts = s.trim().split(Regex("\\s+"))
if (parts.size <= 1) return s.trim()
val first = parts.first()
val rest = parts.drop(1)
return (rest + first).joinToString(" ")
}
fun main() {
val s = "Would you like to know more? (Explore and learn)"
val result = move_first_word_to_end_of_string(s)
println(result)
}
/*
run:
you like to know more? (Explore and learn) Would
*/