Guest User

Untitled

a guest
Oct 17th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. from string import *
  2.  
  3. key_s = str(raw_input("Enter the string you want to search. > "))
  4. target_s = str(raw_input("Enter what you are searching for. > "))
  5. x = 0
  6. recur_counter = 0
  7.  
  8. def count_sub_string_match_recursive(key_s, target_s, x):
  9.     x = find(key_s, target_s, x)
  10.     global recur_counter
  11.     if x >= 0:
  12.         recur_counter += 1
  13.         return count_sub_string_match_recursive (key_s, target_s, x+1)
  14.            
  15. count_sub_string_match_recursive(key_s, target_s, x)
  16. print "This is how many times it shows up.", recur_counter
  17.  
  18.  
Advertisement
Add Comment
Please, Sign In to add comment