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

Acronym Generator

Create an acronym from the first letter of every word, in uppercase.

समस्या

Create an acronym from the first letter of every word, in uppercase. Spaces and hyphens separate words. Remove every other punctuation mark and digit without adding a separator; an apostrophe inside a word does not start another word. Ignore empty pieces.

Implement acronym_generator(phrase).

Input

phrase: The phrase to shorten.

Output

Return the uppercase initials in their original order.

सीमाएँ

0 ≤ phrase length ≤ 10,000. Input contains ASCII letters, digits, spaces, and punctuation; no tabs or line breaks. A phrase with no letters returns empty text.

उदाहरण

उदाहरण 1
इनपुट:
phrase = "central-processing unit"

अपेक्षित आउटपुट:
expected = "CPU"
इनपुट:
std::string phrase = "central-processing unit";

अपेक्षित आउटपुट:
std::string expected = "CPU";
इनपुट:
string phrase = "central-processing unit";

अपेक्षित आउटपुट:
string expected = "CPU";

व्याख्या

The hyphen and space separate central, processing, and unit. Their initials are C, P, and U.

उदाहरण 2
इनपुट:
phrase = "don't repeat yourself"

अपेक्षित आउटपुट:
expected = "DRY"
इनपुट:
std::string phrase = "don't repeat yourself";

अपेक्षित आउटपुट:
std::string expected = "DRY";
इनपुट:
string phrase = "don't repeat yourself";

अपेक्षित आउटपुट:
string expected = "DRY";

व्याख्या

Remove the apostrophe to obtain dont. It is still one word, followed by repeat and yourself.

संदर्भ

यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

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

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

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