Skip to content

Commit d626ccb

Browse files
Find a string hackerrank solution
1 parent bbc94d7 commit d626ccb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Find a string hackerrank

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def count_substring(string, sub_string):
2+
count =0
3+
4+
for i in range(0,len(string)-len(sub_string)+1):
5+
if sub_string==string[i:i+len(sub_string)]:
6+
7+
count+=1
8+
return count
9+
if __name__ == '__main__':
10+
string = input().strip()
11+
sub_string = input().strip()
12+
13+
count = count_substring(string, sub_string)
14+
print(count)

0 commit comments

Comments
 (0)