Count Camel Words

In camelCase, several words are written together: the first starts with a lowercase letter, and each next word starts with an uppercase letter. The function camelcase receives a string s in this format. Count the words in the string: the first word is already present, and every uppercase letter starts a new one. Return that count.

Примеры

Ввод
"saveChangesInTheEditor"
Вывод
5
Ввод
"oneWord"
Вывод
2
Ввод
"word"
Вывод
1

Нужно реализовать

def camelcase(s: str) -> int:

Теги

strings
PostgreSQLv16

Tukaj bo rezultat izvajanja kode

Visible tests
1
Input
"saveChangesInTheEditor"
Expected5
2
Input
"oneWord"
Expected2
3
Input
"word"
Expected1
4
Input
"aBcDeF"
Expected4
5
Input
""
Expected0
6
Input
"word!"
Expected1
Focus radio
Paused · SomaFM · Fluid