Kmp Pattern Searching
hard
1. You are given two strings s1 and s2. 2. s1 represents a text and s2 represents a pattern. 3. You have to print the starting index for all occurrences of the pattern in the given text string.
Constraints
1 <= length of the strings <= 10^4
Format
Input
Two strings s1 and s2 in two different lines.
Output
Starting index for all occurrences of the pattern in the given text string.
Example
Sample Input
abab
ab
Sample Output
0
2
Question Video