आसान 0 हल किए गए 0% स्वीकृति

Replace Spaces With Dashes

Turn spaces into dashes to make a URL-style slug.

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 के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

दूसरों से सीखें

समुदाय समाधान

अभी तक कोई प्रकाशित समाधान नहीं। पहला साझा करने के लिए इस चुनौती को हल करें।