You are viewing a single comment's thread. Return to all comments →
import re text = input() pattern_input = input() s_text = r'(?=(' + re.escape(pattern_input) + r'))' ss = re.finditer(s_text, text) overlapping_matches = [(s.start(1), s.end(1)-1) for s in ss] if overlapping_matches: print(*overlapping_matches, sep='\n') else: print((-1, -1))
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 →