You have a string (indexed from ) with no more than
lowercase characters. Find the first occurrence of a string
, or print
-1
if is not a substring of .
Input Specification
The first line will have the string .
The second line will have the string .
Output Specification
Print the index of the first occurrence of the string in
, or
-1
if it is not a substring of .
Sample Input
higuyshowsitgoinghiguys
higuys
Sample Output
0
Comments
Not sure if my submission should pass it's kinda hacky.
Time to add more test cases I guess...
This comment is hidden due to too much negative feedback. Click here to view it.
is this the most disliked comment?
Yes. (Scroll down a bit.)
C++ disabled
I am getting a warning saying that my default language (C++) has been disabled for this question. Could anyone please tell me why this is the case?
Maybe C++17 is disabled but not other versions of C++.
I use C++11 ... it wasn't working ~12 hours ago - it works fine now.
thanks :)
Is it possible to create a solution for test case # 15 using python 3? I can't seem to run it under the time limit.
Python's builtin
. Rabin-Karp and KMP are two algorithms which have a worst-case runtime of
.
find
uses Boyer-Moore, which has a worst-case runtime of