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
PostgreSQLv16

Här visas resultatet av din kod

Visible tests
1
Input
"catcat"
Expected2
2
Input
"scat ladder"
Expected1
3
Input
"cat"
Expected1
4
Input
"dog"
Expected0
5
Input
"catcatcat"
Expected3
6
Input
""
Expected0
Focus radio
Paused · SomaFM · Fluid