You are viewing a single comment's thread. Return to all comments →
def count_substring(string, sub_string): j=0 for i in range(len(string)+1): if(string.find(sub_string,i,i+len(sub_string))>=0) : j = j+1 return j
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Find a string
You are viewing a single comment's thread. Return to all comments →
def count_substring(string, sub_string): j=0 for i in range(len(string)+1): if(string.find(sub_string,i,i+len(sub_string))>=0) : j = j+1 return j