MCPcopy Create free account
hub / github.com/MohamedMetwalli5/HackerRank-Solutions / count_substring

Function count_substring

PythonSolutions/FindAString.py:1–7  ·  view source on GitHub ↗
(string, sub_string)

Source from the content-addressed store, hash-verified

1def count_substring(string, sub_string):
2 counter = 0
3 for i in range(len(string)):
4 #if(i+len(sub_string)<len(string)):
5 if(string[i:i+len(sub_string)] == sub_string):
6 counter += 1
7 return counter

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected