Create 2 - Substring Counting.py
This commit is contained in:
parent
4195fcf9e2
commit
37f1efca4d
8
8/2 - Substring Counting.py
Normal file
8
8/2 - Substring Counting.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
needle = input()
|
||||||
|
haystack = input()
|
||||||
|
x = 0
|
||||||
|
for i in range(len(haystack)-len(needle) + 1):
|
||||||
|
if haystack[:len(needle)] == needle:
|
||||||
|
x += 1
|
||||||
|
haystack = haystack[1:]
|
||||||
|
print(x)
|
Loading…
Reference in New Issue
Block a user