0 out of 464 challenges solved

Reverse Words in String

Write a Python function `reverse_words(s: str) -> str` that takes a string `s` as input and returns a new string where the order of the words is reversed. Words in the input string are separated by single spaces, and there are no leading or trailing spaces.

#### Example Usage
```python [main.nopy]
reverse_words("hello world")  # Output: "world hello"
reverse_words("python programming")  # Output: "programming python"
reverse_words("a b c")  # Output: "c b a"
```

#### Constraints
- The input string will only contain printable ASCII characters.
- Words are separated by single spaces, and there are no extra spaces in the input string.
def reverse_words(s: str) -> str:
    """
    Reverse the order of words in the input string.

    Args:
    s (str): The input string containing words separated by spaces.

    Returns:
    str: A new string with the words in reversed order.
    """
    # Split the string into words, reverse the list of words, and join them back.
    pass  # Replace this with your implementation