Reverse a String - aloalgo

Reverse a String

Very Easy

You are given a string s consisting of printable characters.

Your task is to return the string with its characters in reverse order.

You may assume that:

  • The string may be empty.
  • The string contains only printable ASCII characters.

Example 1

Input
"hello"
Output
"olleh"
Explanation:

The characters of "hello" reversed are "olleh".

Example 2

Input
"abcd"
Output
"dcba"
Explanation:

The characters of "abcd" reversed are "dcba".

Example 3

Input
""
Output
""
Explanation:

An empty string reversed is still an empty string.

Loading...
Input
"hello"
Output
"olleh"

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!