समस्या
अनुवाद दिखाएँReverse text so the last character comes first.
Implement reverse_string(text).
Input
text: The text to reverse.
Output
Return the reversed text.
सीमाएँ
0 ≤ length ≤ 10,000
उदाहरण
उदाहरण 1
इनपुट:
text = "hello"
अपेक्षित आउटपुट:
expected = "olleh"
इनपुट:
std::string text = "hello";
अपेक्षित आउटपुट:
std::string expected = "olleh";
इनपुट:
string text = "hello";
अपेक्षित आउटपुट:
string expected = "olleh";
व्याख्या
h-e-l-l-o read backwards is "olleh".
उदाहरण 2
इनपुट:
text = "a"
अपेक्षित आउटपुट:
expected = "a"
इनपुट:
std::string text = "a";
अपेक्षित आउटपुट:
std::string expected = "a";
इनपुट:
string text = "a";
अपेक्षित आउटपुट:
string expected = "a";
व्याख्या
A single character reversed is itself.
संदर्भ
यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।