You are viewing a single comment's thread. Return to all comments →
import re n = int(input()) pattern = r'(?<= )(&{2}|\|{2})(?= )' func = lambda x: 'and' if x.group() == '&&' else 'or' for _ in range(n): print(re.sub(pattern, func, input()))
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 →