Nobita and String
Practice
3 (45 votes)
Ad Hoc
Approved
Easy
Implementation
Open
Problem
46% Success 16149 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Doraemon gave Nobita a gadget that swaps words inside a string in the following manner :
If there are W words, word 1 is swapped with word W, word 2 is swapped with word W-1 and so on. The problem is that Nobita himself cannot verify the answer for large strings. Help him write a program to do so.
INPUT :
the first line of the input contains the number of test cases. Each test case consists of a single line containing the string.
OUTPUT :
output the string with the words swapped as stated above.
CONSTRAINTS :
|string length| <= 100000
string contains english alphabets and spaces
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
1.Decode
Points:20
20 votes
Tags:
AlgorithmsEasyString Manipulation
Points:20
17 votes
Tags:
AlgorithmsBasic ProgrammingEasyString Manipulation
Points:20
13 votes
Tags:
AlgorithmsStringBasics of String ManipulationImplementationString AlgorithmsSets
Editorial
Login to unlock the editorial