Skip to content

Reversing Words in a String #30

@freedom5566

Description

@freedom5566

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.

你需要編寫一個可以反轉字串單字的函式,一個單字也能是一個空字串。如果這不夠清楚,這裡是一些範例。

輸入可能有尾隨空格,你還需要忽略不必要的空格。

reverse("Hello World") === "World Hello"
reverse("Hi There.") === "There. Hi"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions