Problem D. Knuth-Morris-Pratt
You are to write a program that receives two strings and finds position where the second string appears in the first
one as a substring.
Input file format
First and second lines of input file contain given strings. Each string is a sequence of lower-case Latin letters from '
' and spaces.
Output file format
Output file must contain a single integer — position of the first occurrence of the substring in a string, or − 1
if there is none. Positions are numbered from 1
Length of each string does not exceed 100000
||Input file (
|Output file (|
yezhiki nachinayut i vyygryvayut