eolymp
bolt
Try our new interface for solving problems

KMP

Find all occurrences of the string \textbf{word} in the string \textbf{text}. \InputFile The first line contains the string \textbf{text}, the second line contains the string \textbf{word}. The length of each string is greater than \textbf{0} and less than \textbf{50000}, the strings contain only latin letters. \OutputFile Print the position numbers from which the string \textbf{word} starts in a string \textbf{text} in ascending order. As is usually in programming, the string positions start from zero.
Time limit 0.1 seconds
Memory limit 128 MiB
Input example #1
ababbababa
aba
Output example #1
0 5 7
Source KMP, Classic