Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Oneliner solution in Clear category for Count Substring Occurrences by mAzrunnr
def count_occurrences(main: str, sub: str) -> int:
return sum(1 for i in range(len(main) - len(sub) + 1) if main[i:i + len(sub)].lower() == sub.lower())
Dec. 14, 2023