Đề bài
Xem bản dịchTake 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".
Ràng buộc
1 ≤ length of full_name ≤ 200; it contains at least one letter
Ví dụ
Đầu vào:
full_name = "Ada Lovelace"
Kết quả mong đợi:
expected = "AL"
Đầu vào:
std::string full_name = "Ada Lovelace";
Kết quả mong đợi:
std::string expected = "AL";
Đầu vào:
string full_name = "Ada Lovelace";
Kết quả mong đợi:
string expected = "AL";
Giải thích
A from Ada and L from Lovelace: "AL".
Đầu vào:
full_name = "grace brewster hopper"
Kết quả mong đợi:
expected = "GBH"
Đầu vào:
std::string full_name = "grace brewster hopper";
Kết quả mong đợi:
std::string expected = "GBH";
Đầu vào:
string full_name = "grace brewster hopper";
Kết quả mong đợi:
string expected = "GBH";
Giải thích
Extra spaces don't matter; the initials are uppercased: "GBH".
Tham khảo
Thử thách này đã được điều chỉnh cho CodeUtility. Hãy làm theo đề bài và các ràng buộc ở trên.