Reverse a String
Implement the reverse_string
function that takes a string slice (&str
) as input and returns a new String
with the characters in reverse order.
Given the input string "hello"
, the function should return "olleh"
:
let reversed = reverse_string("hello"); // "olleh"