#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;
int n;
stack <int> num;
vector<char> res;
int now_num=1;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
while (n--) {
int x;
cin >> x;
while(now_num<=x) {
num.push(now_num++);
res.push_back('+');
}
if(num.top()==x && !num.empty()) {
num.pop();
res.push_back('-');
} else {
cout << "NO";
return 0;
}
}
for(auto c:res) {
cout << c <<'\n';
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: