#K68202. Reverse a String without Built-In Methods

    ID: 32812 Type: Default 1000ms 256MiB

Reverse a String without Built-In Methods

Reverse a String without Built-In Methods

You are given a non-empty string. Your task is to output its reverse without using any built-in reverse methods or slicing shortcuts.

You should implement the reversal using an iterative approach. For example:

  • If the input is hello, then the output should be olleh.
  • If the input is Python, then the output should be nohtyP.

inputFormat

The input consists of a single line containing a non-empty string.

outputFormat

Output the reversed string.## sample

hello
olleh