Count Substring Occurrences

5

1 votes
Z algorithm, Z-algorithm, Very-Easy, Ready, Approved, String
Problem

Given 2 Strings C,S. Find the number of occurrences of C in S. Length of S is N, length of C is M.

Input:

Given 2 Strings C,S.

Output:

Print the number of occurrences of C in S.

Constraints:

1MN105.

Sample Input
abc
abcabdabc
Sample Output
2
Time Limit: 1
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?