Problema
Ver traduçãoReverse text so the last character comes first.
Implement reverse_string(text).
Input
text: The text to reverse.
Output
Return the reversed text.
Restrições
0 ≤ length ≤ 10,000
Exemplos
Exemplo 1
Entrada:
text = "hello"
Saída esperada:
expected = "olleh"
Entrada:
std::string text = "hello";
Saída esperada:
std::string expected = "olleh";
Entrada:
string text = "hello";
Saída esperada:
string expected = "olleh";
Explicação
h-e-l-l-o read backwards is "olleh".
Exemplo 2
Entrada:
text = "a"
Saída esperada:
expected = "a"
Entrada:
std::string text = "a";
Saída esperada:
std::string expected = "a";
Entrada:
string text = "a";
Saída esperada:
string expected = "a";
Explicação
A single character reversed is itself.
Referências
Este desafio foi adaptado para o CodeUtility. Siga o enunciado e as restrições acima.