Einfach 0 gelöst 0% Erfolgsquote

Reverse a String

Return the characters of a string in reverse order.

Reverse text so the last character comes first.

Implement reverse_string(text).

Input

text: The text to reverse.

Output

Return the reversed text.

Einschränkungen

0 ≤ length ≤ 10,000

Beispiele

Beispiel 1
Eingabe:
text = "hello"

Erwartete Ausgabe:
expected = "olleh"
Eingabe:
std::string text = "hello";

Erwartete Ausgabe:
std::string expected = "olleh";
Eingabe:
string text = "hello";

Erwartete Ausgabe:
string expected = "olleh";

Erläuterung

h-e-l-l-o read backwards is "olleh".

Beispiel 2
Eingabe:
text = "a"

Erwartete Ausgabe:
expected = "a"
Eingabe:
std::string text = "a";

Erwartete Ausgabe:
std::string expected = "a";
Eingabe:
string text = "a";

Erwartete Ausgabe:
string expected = "a";

Erläuterung

A single character reversed is itself.

Referenzen

Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.

Von anderen lernen

Community-Lösungen

Noch keine veröffentlichten Lösungen. Löse die Aufgabe und teile als Erster eine Lösung.