Guest User

Untitled

a guest
Jun 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. global pointer
  2.  
  3.  
  4.    
  5.  
  6. def countSubStringMatchRecursive(target1,key):
  7.     count=0
  8.     #pointer=0
  9.     print 'Parent String',target1
  10.     print 'Match key',key
  11.     pointer=subrecfn(target1,key) # returns the pointer of the last match.
  12.     if pointer!=-1:
  13.         count+=1
  14.         target1= target1[pointer:]
  15.         subrecfn(target1,key)
  16.     else:
  17.         print 'No more matches!'
  18.         break
  19.     print 'Total count',counts
  20.    
  21.    
  22.    
  23.    
  24.    
  25.    
  26. def subrecfn(target,key):
  27.     #int pointer## Is this valid in Python, if yes then the function isnt necessary!
  28.     pointer=find(target,key)
  29.     return pointer
Add Comment
Please, Sign In to add comment