Challenge: Extract Initials
Swipe to start coding
You are given a full name as a single string. The name may contain one or more spaces, and you must:
- Extract the first name (everything before the first space).
- Extract the last name (everything after the last space).
- Generate the initials in the format
F.L..
If the input does not contain any spaces, treat the entire string as a first name and display:
- First name
"Last name not found"- Initials using only the first letter (e.g.
J.)
You may use ToUpper() to format the initials, but it is not required. The task is considered correct regardless of letter casing.
Løsning
Takk for tilbakemeldingene dine!
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Fantastisk!
Completion rate forbedret til 4.76
Challenge: Extract Initials
Sveip for å vise menyen
Swipe to start coding
You are given a full name as a single string. The name may contain one or more spaces, and you must:
- Extract the first name (everything before the first space).
- Extract the last name (everything after the last space).
- Generate the initials in the format
F.L..
If the input does not contain any spaces, treat the entire string as a first name and display:
- First name
"Last name not found"- Initials using only the first letter (e.g.
J.)
You may use ToUpper() to format the initials, but it is not required. The task is considered correct regardless of letter casing.
Løsning
Takk for tilbakemeldingene dine!
single