You are viewing a single comment's thread. Return to all comments →
import re def update_string(match): if match.group(1) == '&&': return 'and' else : return 'or' for _ in range(int(input())): result = re.sub(r'(?<=\s)(&&|\|\|)(?=\s)', update_string, input()) print(result)
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 →