Given a person's full name fullName, made of a first name and a last name, return their initials: the first letter of each name, in upper case.
The two names are separated by a single space. The initials are always upper case, even when the name is written in lower case.
Example 1:
Input: fullName = "grace hopper" Output: "GH" Explanation: The first name starts with g and the last name with h. In upper case, they give "GH".
Example 2:
Input: fullName = "Ada Lovelace" Output: "AL" Explanation: A and L are already upper case, so they stay as they are.
Example 3:
Input: fullName = "a b" Output: "AB" Explanation: A name can be a single letter: that letter is its initial.
Constraints:
fullNamehas exactly two words, the first name and the last name, separated by one space.- Both names are made of English letters only, lower case or upper case.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check
