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 Tinus_Trotyl
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())
Oct. 19, 2023