समस्या
अनुवाद दिखाएँReplace every space in text with a dash -, and convert all letters to lowercase.
Implement slugify_spaces(text).
Input
text: The text to convert.
Output
Return the converted text.
सीमाएँ
0 ≤ length of text ≤ 10,000
उदाहरण
उदाहरण 1
इनपुट:
text = "Hello World"
अपेक्षित आउटपुट:
expected = "hello-world"
इनपुट:
std::string text = "Hello World";
अपेक्षित आउटपुट:
std::string expected = "hello-world";
इनपुट:
string text = "Hello World";
अपेक्षित आउटपुट:
string expected = "hello-world";
व्याख्या
The space becomes a dash and letters are lowercased: "hello-world".
उदाहरण 2
इनपुट:
text = "Learn To Code"
अपेक्षित आउटपुट:
expected = "learn--to-code"
इनपुट:
std::string text = "Learn To Code";
अपेक्षित आउटपुट:
std::string expected = "learn--to-code";
इनपुट:
string text = "Learn To Code";
अपेक्षित आउटपुट:
string expected = "learn--to-code";
व्याख्या
Each space becomes its own dash: "learn--to-code".
संदर्भ
यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।