文章
8
粉丝
0
获赞
18
访问
3.6k
#include<bits/stdc++.h> //上一题1067
using namespace std;
int main(){
string s;
while (getline(cin,s)){
vector<char> r(s.length(), ' '); // 初始化vector,长度与s相同,默认空格
stack<char> st;
for(int i=0;i<s.length();i++){
if(s[i]==')'){
if(!st.empty()){ //不为空
if(st.top()=='('&&s[i]==')') {
st.pop();
}
}else r[i]='?'; //为空
}else if(s[i]=='(') { //左括号
st.push(s[i]);
&...
登录后发布评论
暂无评论,来抢沙发