98. Reverse the Words

Acceptance — 0 accepted 0 submissions

Easy
StringsTwo Pointers
No companies listed
Yoda from Star Wars speaks in reverse order, he does. Turn a normal sentence into Yoda-speak by reversing the order of the words (not the letters).

Input Format
A single line of words separated by single spaces.

Output Format
Print the words in reverse order, separated by single spaces.

Constraints
• 1 ≤ length ≤ 1000

Example 1

Input
i love chai
Output
chai love i

Explanation The last word comes first. Each word itself is not reversed.

Example 2

Input
BashaByte
Output
BashaByte

Explanation One word stays the same.

Example 3

Input
one two three four
Output
four three two one

Explanation Four words in the opposite order.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
chai love i
No results yet
Run your code to test it against the sample cases.
Problem List