You are viewing a single comment's thread. Return to all comments →
import re def search(sub_str,string,ind = 0): result = re.search(sub_str,string) if result == None: if ind == 0: return "(-1, -1)" else : return "" start = result.start() end = result.end() return f"({start+ind}, {end+ind-1})\n"+search(sub_str,string[start+1:],ind+start+1) if __name__ == "__main__": s = input() k = input() print(search(k,s))
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 →