Cat Counter
Counting substrings is often useful in text, logs, and simple filters. Write a function cat_count that takes a string s and counts how many times the substring cat appears in it. Return the count as an integer.
Примеры
Ввод
"catcat"Вывод
2Ввод
"scat ladder"Вывод
1Ввод
"cat"Вывод
1Нужно реализовать
def cat_count(s: str) -> int:
Теги
strings
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
"catcat"Expected
22
Input
"scat ladder"Expected
13
Input
"cat"Expected
14
Input
"dog"Expected
05
Input
"catcatcat"Expected
36
Input
""Expected
0Focus radio
Paused · SomaFM · Fluid