Problem
Reverse text so the last character comes first.
Implement reverse_string(text).
Input
text: The text to reverse.
Output
Return the reversed text.
Constraints
0 ≤ length ≤ 10,000
Examples
Example 1
Input:
text = "hello"
Expected output:
expected = "olleh"
Input:
std::string text = "hello";
Expected output:
std::string expected = "olleh";
Input:
string text = "hello";
Expected output:
string expected = "olleh";
Explanation
h-e-l-l-o read backwards is "olleh".
Example 2
Input:
text = "a"
Expected output:
expected = "a"
Input:
std::string text = "a";
Expected output:
std::string expected = "a";
Input:
string text = "a";
Expected output:
string expected = "a";
Explanation
A single character reversed is itself.
References
This challenge is adapted for CodeUtility. Follow the statement and constraints above.