Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Count Substring Occurrences by estelle.doriot
def count_occurrences(main_str: str, sub_str: str) -> int:
return sum(
main_str[i : i + len(sub_str)].lower() == sub_str.lower()
for i in range(len(main_str))
)
Jan. 8, 2024