#K79957. Correctly Capitalized String Check
Correctly Capitalized String Check
Correctly Capitalized String Check
Given a string S, determine whether each word in the string is correctly capitalized according to the Royal Typographic Society's guidelines. A word is considered correctly capitalized if it meets one of the following conditions:
- The word is composed entirely of uppercase letters, or
- Only the first letter is uppercase and all subsequent letters are lowercase.
For example, Hello World
and HELLO WORLD
are correctly capitalized, while Hello world
is not.
Note: The evaluation should be made on a per-word basis.
inputFormat
The input consists of a single line containing the string S. The string may include multiple words separated by spaces.
outputFormat
Output True
if the string S follows the capitalization rules, otherwise output False
. The output should be printed on stdout.
Hello World
True
</p>