Find the Pattern
Print the 0-based index of the first occurrence of pattern in text , or -1. For long inputs a naive search may be too slow in worst cases — try the KMP algorithm.
Input
Line 1: text . Line 2: pattern .
Output
The index or -1.
Constraints
, lowercase letters.
Sample 1
Input
hello ll
Output
2
Sample 2
Input
aaaaa bba
Output
-1