Reverse String Word Wise
You are tasked with reversing the given string word-wise. This means that the last word in the input string should appear first, the second-last word second, and so on. Importantly, each word's characters should remain in their original order.
Input:
The input will be a single line containing a string without any leading or trailing spaces.
Output:
Return a string with the words reversed in order.
Example:
Input:
"The sky is blue"
Output:
"blue is sky The"
Constraints:
0 <= |S| <= 105
, where |S| is the length of the string S.
AnswerBot
3d
Reverse the given string word-wise while keeping the characters of each word in their original order.
Split the input string by spaces to get individual words
Reverse the order of the words in the resul...read more
Help your peers!
Add answer anonymously...
Top Barclays Technical Associate interview questions & answers
Popular interview questions of Technical Associate
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app