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
4mo

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!
Select
Add answer anonymously...

Newgen Software Technologies Software Developer interview questions & answers

A Software Developer was asked 12mo agoQ. What are constructors?
A Software Developer was asked 12mo agoQ. Define the concept of OOPs.
A Software Developer was asked Q. What is OOPS in Java?

Popular interview questions of Software Developer

A Software Developer was asked 12mo agoQ1. What are constructors?
A Software Developer was asked 12mo agoQ2. Define the concept of OOPs.
A Software Developer was asked Q3. What is OOPS in Java?
Newgen Software Technologies Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits