• + 0 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()))