http://ybt.ssoier.cn:8088/problem_show.php?pid=1203
应该是爆stack了不知道怎么改
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct Node{
int z;char c;
};
signed main(){
string a;
while(cin>>a){
cout<<a<<'\n';
Node tmp;stack<Node>s;
for(int i=0;i<a.size();i++){
if(a[i]=='('){
tmp.z=i;
tmp.c='(';
s.push(tmp);
}
if(a[i]==')'){
if(s.size()>0) s.pop();
else{
tmp.z=i;
tmp.c='B';
s.push(tmp);
}
}
}
int si=s.size();
for(int i=0;i<a.size();i++){
if(s.top().z==i){
cout<<"$";
if(s.size()>0)s.pop();
}else if(s.top().z==i&&s.top().c=='B'){
cout<<"?";
if(s.size()>0)s.pop();
}else{
cout<<" ";
}
}
cout<<"\n";
}
return 0;
}