We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Re.start() & Re.end()
Re.start() & Re.end()
Sort by
recency
|
356 Discussions
|
Please Login in order to post a comment
The problem description is unclear and misleading.
The test cases do not use regex, and the algorithm does not require the use of regex, so why is it even mentioned in the problem description?
start/end is not a good verb pairing for an API. It should be start/stop, or begin/end.
Furthermore, the test cases require printing values to stdout, not implementing start/end APIs, so again, why are those even mentioned?
import re S = input() k = input()
find_match = list(re.finditer(rf"(?=({k}))", S))
if find_match: for i in find_match: print ((i.start(1), i.end(1)-1))
else: print((-1, -1))
result
My solution: