#C14487. Reverse a String Without Using Built-in Functions

    ID: 44141 Type: Default 1000ms 256MiB

Reverse a String Without Using Built-in Functions

Reverse a String Without Using Built-in Functions

Given a string ( s ), your task is to output a new string which is the reverse of ( s ). You must not use any built-in reverse functions or slicing techniques. Instead, implement the reversal by iterating through the string and prepending each character to a result string.

For example, if the input is hello, the output should be olleh.

inputFormat

The input consists of a single line containing the string ( s ). It can be an empty string or a string that includes spaces and punctuation.

outputFormat

Output a single line containing the reversed string.## sample

a
a