#include <bits/stdc++.h>

using namespace std;

void fast_io() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
}

void solve() {
	string s;
	cin >> s;
	bool flg = true;
	int n = s.size();
	auto op_ok = [&](int i) {
		if (i == 0 || (s[i - 1] == '+' || s[i - 1] == '-')) return false;
		if (i == n - 1 || (s[i + 1] == '+' || s[i + 1] == '-')) return false;
		return true;
	};
	for (int i = 0; i < n; i++) {
		if (s[i] == '+') {
			flg = true;
			continue;
		}
		if (s[i] == '-') {
			flg = false;
			continue;
		}
		if (s[i] == '?') {
			if (flg) {
				s[i] = '9';
			} else if (op_ok(i)) {
				s[i] = '+';
				flg = true;
			} else {
				s[i] = '1';
			}
		}
	}
	cout << s << "\n";
}
int main() {
	fast_io();
	int t;
	cin >> t;
	for (; t--;) {
		solve();
	}
}