654. Reverse Words in a String
0
Medium
Given a string input, the task is to reverse the order of the words in the string. Multiple spaces should be replaced with a single space.
Input Format
The input should be a line containing multiple words.
Output Format
The output should be the string with the words in reversed order.
Example
Input
Input: the sky is blue
Output
Output: blue is sky the
Constraints
The length of the input string should not exceed 10^4.
Loading...
View Submissions
Console