Problema
Ver traducciónReverse text so the last character comes first.
Implement reverse_string(text).
Input
text: The text to reverse.
Output
Return the reversed text.
Restricciones
0 ≤ length ≤ 10,000
Ejemplos
Ejemplo 1
Entrada:
text = "hello"
Salida esperada:
expected = "olleh"
Entrada:
std::string text = "hello";
Salida esperada:
std::string expected = "olleh";
Entrada:
string text = "hello";
Salida esperada:
string expected = "olleh";
Explicación
h-e-l-l-o read backwards is "olleh".
Ejemplo 2
Entrada:
text = "a"
Salida esperada:
expected = "a"
Entrada:
std::string text = "a";
Salida esperada:
std::string expected = "a";
Entrada:
string text = "a";
Salida esperada:
string expected = "a";
Explicación
A single character reversed is itself.
Referencias
Este reto está adaptado para CodeUtility. Sigue el enunciado y las restricciones indicadas arriba.