fork download
  1. def stringgen():
  2. target1='atgacatgcacaagtatgcat'
  3. key='atgc'
  4. #print target1,key
  5. countSubStringMatchRecursive(target1,key)
  6.  
  7.  
  8.  
  9.  
  10. def countSubStringMatchRecursive(target1,key):
  11. count=0
  12. pointer=0
  13. print 'Parent String',target1
  14. print 'Match key',key
  15. pointer=subrecfn(target1,key) # returns the pointer of the last match.
  16. if pointer!=-1:
  17. count+=1
  18. target1= target1[pointer:]
  19. subrecfn(target1,key)
  20. else:
  21. print 'No more matches!'
  22. break
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. def subrecfn(target,key):
  31. int pointer## Is this valid in Python, if yes then the function isnt necessary!
  32. pointer=find(target,key)
  33. return pointer
  34.  
  35.  
Runtime error #stdin #stdout 0.02s 5852KB
stdin
Standard input is empty
stdout
Standard output is empty