Đề bài
Xem bản dịchReverse text so the last character comes first.
Implement reverse_string(text).
Input
text: The text to reverse.
Output
Return the reversed text.
Ràng buộc
0 ≤ length ≤ 10,000
Ví dụ
Ví dụ 1
Đầu vào:
text = "hello"
Kết quả mong đợi:
expected = "olleh"
Đầu vào:
std::string text = "hello";
Kết quả mong đợi:
std::string expected = "olleh";
Đầu vào:
string text = "hello";
Kết quả mong đợi:
string expected = "olleh";
Giải thích
h-e-l-l-o read backwards is "olleh".
Ví dụ 2
Đầu vào:
text = "a"
Kết quả mong đợi:
expected = "a"
Đầu vào:
std::string text = "a";
Kết quả mong đợi:
std::string expected = "a";
Đầu vào:
string text = "a";
Kết quả mong đợi:
string expected = "a";
Giải thích
A single character reversed is itself.
Tham khảo
Thử thách này đã được điều chỉnh cho CodeUtility. Hãy làm theo đề bài và các ràng buộc ở trên.