समस्या
मूल (अंग्रेज़ी) दिखाएँहर स्पेस को text में डैश - से बदलें, और सभी अक्षरों को लोअरकेस में बदलें।
slugify_spaces(text) को इम्प्लीमेंट करें।
इनपुट
text: वह टेक्स्ट जिसे बदलना है।
आउटपुट
बदला हुआ टेक्स्ट लौटाएँ।
सीमाएँ
0 ≤ 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";
व्याख्या
स्पेस डैश में बदल गया और अक्षर लोअरकेस हो गए: "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";
व्याख्या
हर स्पेस अपना अलग डैश बना: "learn--to-code"।
संदर्भ
यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।