Reverse a string
Print the string reversed. Try it without a built-in reverse function.
Reported in: Tech Mahindra, LTIMindtree, Cognizant GenC (memory-based)
Input
One line: the string.
Output
The reversed string.
Constraints
1 ≤ length ≤ 10^5.
Example 1
Input:
Osmania
Output:
ainamsOExample 2
Input:
a b c
Output:
c b aHint: Swap characters from both ends, or build the result from the last character backwards.