URL: https://leetcode.com/problems/reverse-words-in-a-string/ Signed-off-by: Matej Focko <me@mfocko.xyz>
3 lines
120 B
Kotlin
3 lines
120 B
Kotlin
class Solution {
|
|
fun reverseWords(s: String): String = s.trim().split(Regex("\\s+")).reversed().joinToString(" ")
|
|
}
|