A website creates a user ID from each person's name: the first 2 letters of the first name, followed by the last 3 letters of the last name.
Given the first name first and the last name last, return the ID.
Example 1:
Input: first = "John", last = "Smith" Output: "Joith" Explanation: "Jo" are the first 2 letters of "John" and "ith" are the last 3 letters of "Smith".
Example 2:
Input: first = "Jo", last = "Doe" Output: "JoDoe" Explanation: "Jo" has exactly 2 letters and "Doe" exactly 3, so both names are used whole.
Example 3:
Input: first = "ada", last = "Lovelace" Output: "adace" Explanation: The letters keep their case: the ID doesn't change any letter to upper or lower case.
Constraints:
firsthas at least 2 letters andlasthas at least 3 letters.- Both names are made of English letters only, lowercase or uppercase.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check
