import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
input = sys.stdin.readline
#sys.setrecursionlimit(10**9)
t = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
#n,m = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
def solve():
    s = list(input().rstrip())
    p = 1
    x = 0
    n = len(s)
    for i in range(n):
        if s[i] == '?':
            if p == 1:
                s[i] = '9'
            else:
                if i > 0 and s[i-1] == '-':
                    s[i] = '1'
                else:
                    if (i > 0 and (s[i-1] != '+' and s[i-1] != '-')) and (i != n-1 and (s[i+1] != '+' and s[i+1] != '-')):
                        s[i] = '+'
                        p = 1
                    else:
                        s[i] = '1'
                        
        if s[i] == '+':
            p = 1
        if s[i] == '-':
            p = -1
    print(''.join(s))
        
    
                    



for i in range(t):
    solve()