All challenges
Easy 0 solved 0% acceptance

Initials From a Name

Build uppercase initials from a full name.

Problem

Take the first letter of each word in full_name, uppercase it, and join the letters. Words are separated by one or more spaces.

Implement initials(full_name).

Input

full_name: A name made of letters and spaces.

Output

Return the initials, for example "ADL".

Constraints

1 ≤ length of full_name ≤ 200; it contains at least one letter

Examples

Example 1
Input:
full_name = "Ada Lovelace"

Expected output:
expected = "AL"
Input:
std::string full_name = "Ada Lovelace";

Expected output:
std::string expected = "AL";
Input:
string full_name = "Ada Lovelace";

Expected output:
string expected = "AL";

Explanation

A from Ada and L from Lovelace: "AL".

Example 2
Input:
full_name = "grace  brewster  hopper"

Expected output:
expected = "GBH"
Input:
std::string full_name = "grace  brewster  hopper";

Expected output:
std::string expected = "GBH";
Input:
string full_name = "grace  brewster  hopper";

Expected output:
string expected = "GBH";

Explanation

Extra spaces don't matter; the initials are uppercased: "GBH".

References

This challenge is adapted for CodeUtility. Follow the statement and constraints above.

Learn from others

Community solutions

No published solutions yet. Solve this challenge to share the first one.