#C12823. Reverse String Without Built-in Functions

    ID: 42293 Type: Default 1000ms 256MiB

Reverse String Without Built-in Functions

Reverse String Without Built-in Functions

Your task is to implement a function that reverses a given string s without using any built-in reverse functions or slicing capabilities. The solution must work for any valid string including empty strings, strings with spaces, numbers, and special characters.

The reversal process is defined as follows: if the input string is \( s \) with length \( n \), then the output string \( r \) is generated such that \( r_i = s_{n-i+1} \) for \( 1 \le i \le n \).

Input: A single line containing the string s.

Output: The reversed string.

inputFormat

The input consists of a single line read from standard input which contains the string \( s \). Note that \( s \) may be empty and may include spaces and special characters.

outputFormat

Output the reversed version of the string \( s \) on a single line to standard output.

## sample