Guest User

Untitled

a guest
Sep 25th, 2011
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. count = 0
  2.  
  3. def countSubStringMatchRecursive(target, key):
  4.     """
  5.    Counts recursively the number of times key appears in target
  6.    """
  7.     global count
  8.     count = 0
  9.    
  10.     if len(target) > len(key):
  11.         countSubStringMatchRecursive(target[1:], key)
  12.  
  13.     if target[:len(key)].find(key) > -1:
  14.         count += 1
  15.     print count
Advertisement
Add Comment
Please, Sign In to add comment