Problema
Mostra traduzioneReverse text so the last character comes first.
Implement reverse_string(text).
Input
text: The text to reverse.
Output
Return the reversed text.
Vincoli
0 ≤ length ≤ 10,000
Esempi
Esempio 1
Input:
text = "hello"
Output atteso:
expected = "olleh"
Input:
std::string text = "hello";
Output atteso:
std::string expected = "olleh";
Input:
string text = "hello";
Output atteso:
string expected = "olleh";
Spiegazione
h-e-l-l-o read backwards is "olleh".
Esempio 2
Input:
text = "a"
Output atteso:
expected = "a"
Input:
std::string text = "a";
Output atteso:
std::string expected = "a";
Input:
string text = "a";
Output atteso:
string expected = "a";
Spiegazione
A single character reversed is itself.
Riferimenti
Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.