TORONTO KIDS COMPUTER CLUB | Aurora Saturday 14:30 Python Practice 22.12.03.
21498
post-template-default,single,single-post,postid-21498,single-format-standard,ajax_fade,page_not_loaded,,no_animation_on_touch,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Aurora Saturday 14:30 Python Practice 22.12.03.

08 Dec Aurora Saturday 14:30 Python Practice 22.12.03.

Question: 

Given a string with length of n and a substring with length of m(0<m<=n<=1000), write program to search all occurrences of substring in string. Once the substring is found, the next substring should start from the character after the previous substring, such as there are maximum 3 ‘aa’ could be found in the ‘aaaaaa’

Input Specification:
Each line contains a string A and a substring B.
The input ends at #

Output Specification:
print the maximum occurrences of substring in string.

Sample Input:
abcde a3
aaaaaa aa
#

Sample Output:
0
3

No Comments

Sorry, the comment form is closed at this time.