Convert to Title Case

Given a printable ASCII string s, return its title-case form. A word is a maximal sequence of characters separated by the ASCII space character (U+0020). For…

Given a printable ASCII string `s`, return its title-case form. A word is a maximal sequence of characters separated by the ASCII space character (`U+0020`). For each word, uppercase its first character if that character is an English letter, lowercase every later English letter, and preserve every digit and punctuation character unchanged. Preserve all spaces exactly, including repeated, leading, and trailing spaces.

- `0 <= s.length <= 40` - `s` contains printable ASCII characters from `U+0020` through `U+007E` only. - The ASCII space character is the only word separator.

Example 1: input s = "hello WORLD"; output "Hello World". Each word begins with an uppercase letter and its remaining letters become lowercase.

Example 2: input s = "multiple SPACES"; output "Multiple Spaces". The three spaces are preserved exactly while both words are normalized.

Example 3: input s = "release-NOTES v2"; output "Release-notes V2". The hyphen and digit remain unchanged; they do not create another word boundary.

Category: Strings. Topic: strings. Difficulty: Easy. Patterns: string-processing.