You are working as a data engineer for a content management system that needs to standardize text formatting across their database. Your task is to create a title case transformation function that capitalizes the first letter of each word while converting all other letters to lowercase.
Given a table user_content with columns content_id and content_text, you need to:
- Capitalize the first letter of each word
- Convert all other letters to lowercase
- Preserve all existing spaces exactly as they are
- Return both the original text and the transformed text
The challenge lies in handling various edge cases like multiple consecutive spaces, mixed-case words, and all-caps text. This is commonly needed for cleaning user-generated content, standardizing titles, or preparing text for display.
Note: The input contains only alphabetic characters and spaces - no special characters or punctuation.
Input & Output
Constraints
- 1 โค content_text.length โค 1000
- content_text contains only alphabetic characters and spaces
- No leading or trailing spaces guaranteed, but may exist
- Multiple consecutive spaces may exist and must be preserved