Advertisement
EXTREMEXPLOIT

Count Substring

Sep 6th, 2019
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. def Count_Substring(STR, SUB_STR):
  2.     SUB_LEN = len(SUB_STR)
  3.     Counter = 0
  4.     for i in range (len(STR)):
  5.         if STR[i] == SUB_STR[0]:
  6.             TEMP = STR[i:i+SUB_LEN]    
  7.             if TEMP == SUB_STR:
  8.                 Counter += 1
  9.    
  10.     return Counter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement