Description
Given a string title consisting of words separated by spaces, capitalize each word that has length > 2, otherwise make it lowercase. Return the capitalized title.
Examples
Input:
title = "capiTalIze tHe titLe"Output:
"Capitalize The Title"Explanation:
Words formatted.
Input:
title = "i am a go PRO"Output:
i am a GO ProExplanation:
Words with length ≤ 2 ('i', 'am', 'a', 'GO') are lowercased, while words with length > 2 ('PRO') are capitalized with only the first letter uppercase.
Input:
title = "HELLO world MY friend"Output:
Hello World my FriendExplanation:
Words longer than 2 characters ('HELLO', 'world', 'friend') get capitalized (first letter uppercase, rest lowercase), while 'MY' becomes 'my' since it has exactly 2 characters.
Constraints
- •
1 ≤ title.length ≤ 100