You are viewing a single comment's thread. Return to all comments →
import re string = input() k = input() pattern = f"(?=({k}))" matches = re.finditer(pattern, string) indices = [] for match in matches: indices.append((match.start(), match.start() + len(k) - 1)) if not indices: print((-1, -1)) else: for x in indices: print(x)
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 →