We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Strings
- Find a string
- Discussions
Find a string
Find a string
Sort by
recency
|
3329 Discussions
|
Please Login in order to post a comment
def count_substring(string, sub_string): count = 0 start = 0
if name == 'main': string = input().strip() sub_string = input().strip()
Slightly modified the answer from matheus_santos5:
Need to consider case where charachter overlaps
def count_substring(string, sub_string): count = 0 start = 0 sub_len = len(sub_string)
Here is a different approach than usual