You need to write a function that reverses the words in a given string. A word can also fit an empty string. If this is not clear enough, here are some examples:
As the input may have trailing spaces, you will also need to ignore unneccesary whitespace.
https://www.codewars.com/kata/reversing-words-in-a-string
題目:
You need to write a function that reverses the words in a given string. A word can also fit an empty string. If this is not clear enough, here are some examples:
As the input may have trailing spaces, you will also need to ignore unneccesary whitespace.
你需要編寫一個可以反轉字串單字的函式,一個單字也能是一個空字串。如果這不夠清楚,這裡是一些範例。
輸入可能有尾隨空格,你還需要忽略不必要的空格。