Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import *
- def countSubStringMatchExact(target, key):
- ans=()
- for i in range(0,len(target) + 1): # Add + 1 to the end point of the range, because the amount of indices are 1 greater than the length of a string.
- duplicate = False # This will keep track of if a duplicate is found.
- if find(target,key,i) == -1:
- return ans
- for n in ans: # Goes through the tuple and checks to see if the current answer is in it.
- if find(target,key,i) == n:
- duplicate = True # If it is in it, we know it's a duplicate.
- if not duplicate: # Will only add to our tuple if it isn't a duplicate.
- ans += ((find(target,key,i)),)
- return ans
Advertisement
Add Comment
Please, Sign In to add comment