Learn
Exam

String Reversal

Difficulty
STARTER

Problem

Given a string word, write a function solution that returns the reversed version of the string.


Constraints

  • word consists only of lowercase English letters.
  • The length of word is between 1 and 100 inclusive.

Test Case

Test Case Number word return
1 "hello" "olleh"
2 "algorithm" "mhtirogla"
3 "python" "nohtyp"

Explanation for Test Case 1

  • When word = "hello", reversing the string yields "olleh".

Explanation for Test Case 2

  • When word = "algorithm", reversing the string yields "mhtirogla".

Explanation for Test Case 3

  • When word = "python", reversing the string yields "nohtyp".