FunctionRacerProblemsRace

Count Capitalized Words

BeginnerStringsPython, JavaScript, TypeScript, Java, C++

sentence is a line of words separated by single spaces, with no space at either end. It may also be the empty string, which holds no words.

A word is capitalized when its first character is an uppercase letter A to Z; the rest of the word does not matter, so NASA and Tom's are both capitalized while iPhone and 3rd are not. Return how many words of sentence are capitalized.

Example 1

sentence "The Quick brown Fox"
returns 3

The, Quick and Fox start with an uppercase letter; brown does not.

Example 2

sentence "hello world"
returns 0

No word starts with an uppercase letter.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems