class Solution {
fun reverseWords(s: String): String {
var strArray = s.split(' ').map{it.toString().trim()}.filter{it != ""}
var answer = ""
for(i in strArray.size-1 downTo 1){
answer += strArray[i]
answer += " "
}
answer += strArray[0]
return answer
}
}