#C9830. Title Formatter
Title Formatter
Title Formatter
You are given a string that may contain excess whitespace. Your task is to format the string as a title following these rules:
- The first letter of each word must be capitalized and the rest of the letters in that word must be in lowercase.
- Words in the output should be separated by a single space.
- Any leading, trailing, or extra spaces between words in the input should be removed so that only one space separates words.
- If the string contains any non-alphabetic characters (other than spaces), output
None
.
For example, an input of " hello world " should yield "Hello World", while an input of "3 elephants are here" should yield "None".
inputFormat
The input consists of a single line containing a string. This string may have leading, trailing or multiple intermediate spaces.
outputFormat
If the input contains any non-alphabetic characters (excluding spaces), output None
(without quotes). Otherwise, output the formatted title string.
hello world
Hello World