Reverse a string with spaces intact
Submissions: 968   Accuracy:

24.2%

  Difficulty: Basic   Marks: 1

Given a string, your task is to reverse the string keeping the spaces intact to their positions.

Input:
The first line of input contains an integer T denoting the number of test cases.Each test case consist of a string.

Output:
Print the reverse of the string while keeping the spaces intact to their positions.

Constraints:
1<=T<=100

Example:
Input:
2
Help others
abcd efg
Output:
sreh topleH
gfed cba

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Shubham Chaudhary
Author: Shubham Chaudhary gfg


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.