IntermediateRating 1400
Count Occurrences
Count how many times pattern p occurs in text s, overlaps included.
Input
Two lines: s, then p.
Output
A count.
Sample 1
Input
aaaa aa
Output
3
Sample 2
Input
abababa aba
Output
3
Output appears hereTwo lines: s, then p.
A count.
aaaa aa
3
abababa aba
3
Output appears here