#include <bits/stdc++.h> void solve() { std::string S; std::cin >> S; bool minus = false; for (int i = 0; i < (int)S.size(); i++) { if (S[i] != '?') { if (S[i] == '-') { minus = true; } if (S[i] == '+') { minus = false; } } else { if (minus) { if (i > 0 && i + 1 < (int)S.size() && '0' <= S[i - 1] && S[i - 1] <= '9' && ('0' <= S[i + 1] && S[i + 1] <= '9' || S[i + 1] == '?')) { S[i] = '+'; minus = false; } else { S[i] = '1'; } } else { S[i] = '9'; } } std::cout << S[i]; } std::cout << '\n'; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int T; std::cin >> T; for (;T--;) { solve(); } }