You are viewing a single comment's thread. Return to all comments →
import re n = int(input()) text = [input() for x in range(n)] pattern1 = re.compile(r'(?<= )&&(?= )') pattern2 = re.compile(r'(?<= )\|\|(?= )') for x in text: x = (re.sub(pattern1, "and", x)) x = (re.sub(pattern2, "or", x)) print(x)
Seems like cookies are disabled on this browser, please enable them to open this website
Regex Substitution
You are viewing a single comment's thread. Return to all comments →