Problem 163575 · medium · Level 01 Prerequisites & Setup

Headline Check

strings · split · iteration · isupper · islower

An editor requires headlines in title case: in every word, the first letter is uppercase and all its other letters are lowercase. Given headline, return True if it follows the rule and False otherwise. Words are separated by spaces. Only letters are checked: digits and punctuation may appear anywhere (Top-10, (Draft) and 10-Year are fine), and a word with no letters at all, such as 2026, is fine too. An empty headline has no words, so it counts as valid.

Examples

Input:  headline = "The Quick Brown Fox"
Output: True

Input:  headline = "The quick Brown Fox"
Output: False

Input:  headline = "NASA Launches Rocket"
Output: False

Input:  headline = "Top-10 Tips For 2026"
Output: True
Explanation: in Top-10 the letters are T, o, p; 2026 has no letters, so nothing in it can break the rule.

Constraints

  • 0 <= len(headline) <= 1000
  • headline may contain letters, digits, spaces and punctuation

Goals

  • Split a sentence into words
  • Inspect the first character and the rest of each word separately
  • Return False as soon as a word breaks the rule
Starting Python…