def solve(): S = input() T = [] plus = True for i, s in enumerate(S): if s == "+": plus = True T.append("+") elif s == "-": plus = False T.append("-") elif s == "?": if plus: T.append("9") else: if S[i - 1] == "-": T.append("1") elif i + 1 < len(S) and S[i + 1] not in "+-": T.append("+") plus = True else: T.append("1") else: T.append(s) print(*T, sep="") for _ in range(int(input())): solve()