Capitalize the Title Problem
Capitalize the Title Problem — ExecCode Easy DSA Practice
Solve the Capitalize the Title problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given a string title consisting of one or more words separated by a single space, where each word consists of English letters. Your task is to compute the required answer and return the capitalized title. Capitalize the string by changing the capitalization of each word such that: - If the length of the word is 1 or 2 letters, change all letters to lowercase. - Otherwise, change the first letter to uppercase and the remaining letters to lowercase.
Examples
Input {"title": "capiTalIze tHe titLe"}; Output Capitalize The Title. Input {"title": "First leTTeR of EACH Word"}; Output First Letter of Each Word
Constraints
1 <= title.length <= 100 title consists of words separated by a single space without any leading or trailing spaces. Each word consists of uppercase and lowercase English letters and is non-empty.
Practice Capitalize the Title free on ExecCode. Browse DSA problems, topic map, and placement guides.