Redirecting to
NADOS

Kmp Pattern Searching

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.
Input Format
Two strings s1 and s2 in two different lines.
Output Format
Starting index for all occurrences of the pattern in the given text string.
Question Video
Constraints
1 <= length of the strings <= 10^4
Sample Input
abab
ab
Sample Output
0
2


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name