Notiek uzdevuma ielāde…
Sometimes you need to check whether two markers appear in text the same number of times. Write a function cat_dog that takes a string s and counts the occurrences of the substrings cat and dog. Return True if the counts are equal, otherwise return False.
"catdog"True"catcat"False"1cat1cadodog"Truedef cat_dog(s: str) -> bool:
Pieslēdzies, lai redzētu iesniegumu vēsturi
PieslēgtiesPieslēdzies, lai izmantotu AI mentoru
PieslēgtiesThey run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.