Reverse Word Order
EasyStringSorting
Description
Given a string s of words separated by single spaces, return a string with the words in reverse order.
Examples
Input:
s = "the quick brown fox"Output:
"fox brown quick the"Explanation:
Listing the words in reverse order produces "fox brown quick the".
Input:
s = "hello world"Output:
"world hello"Explanation:
Listing the words in reverse order produces "world hello".
Input:
s = "code arena rules"Output:
"rules arena code"Explanation:
Listing the words in reverse order produces "rules arena code".
Constraints
- •
1 ≤ s.length ≤ 10⁴ - •
Words are separated by single spaces.