Draft saved on this device
▤ Description
Core C++Easy
Reverse A String Without Extra Allocation
Read a single line of text, including possible spaces, and print the characters in reverse order.
Read a single line of text, including possible spaces, and print the characters in reverse order. Use an in-place reversal of the C++ string buffer rather than allocating another string. The input is ASCII text.
Input format
One line of up to 100000 printable ASCII characters.
Output format
Print the reversed line.
Examples
Example 1
Input
C++ Valley
Expected output
yellaV ++C
Constraints
- 0 ≤ line length ≤ 100000
- Printable ASCII input only.
Related concepts
This early-access exercise uses standard input/output. More advanced concurrency challenges will use specialized class interfaces, instrumentation, and stress tests once the judging infrastructure is ready.
⌘ Code
Loading Monaco C++ editor…
Checking judge...
Checking whether the external C++ judge is available.
⌁ Test cases & resultsPublic samples: 1
Input
C++ Valley
Expected output
yellaV ++C