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.
for match in re.finditer(r'(?=('+re.escape(k)+'))', s):
found = True
start_index = match.start(1)
end_index = match.end(1) - 1
print((start_index, end_index))
if not found:
print((-1, -1))
if not found:
print((-1, -1))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Re.start() & Re.end()
You are viewing a single comment's thread. Return to all comments →
` import re
s = input().strip() k = input().strip()
found = False
for match in re.finditer(r'(?=('+re.escape(k)+'))', s): found = True start_index = match.start(1) end_index = match.end(1) - 1 print((start_index, end_index))
if not found: print((-1, -1))
if not found: print((-1, -1))