Reverse string Word Wise

Moderate
0/80
17 upvotes
Asked in companies
IBMIONBirdEye

Problem statement

Reverse the given string word wise. That is, the last word in given string should come at 1st place, last second word at 2nd place and so on. Individual words should remain as it is.

Detailed explanation ( Input/output format, Notes, Images )
Input format :
String in a single line
Output format :
Word wise reversed string in a single line
Constraints :
0 <= |S| <= 10^7
where |S| represents the length of string, S.
Sample Input 1:
Welcome to Coding Ninjas
Sample Output 1:
Ninjas Coding to Welcome
Sample Input 2:
Always indent your code
Sample Output 2:
code your indent Always
Approaches (1)
Time Complexity
Space Complexity
Code Solution
(100% EXP penalty)
Reverse string Word Wise
Full screen
Console