文章
16
粉丝
402
获赞
21
访问
156.5k
#include <bits/stdc++.h>
using namespace std;
int main(){
stack<char> all;
string str;
char now;
getline(cin,str);
for (int i = 0; i < str.size(); i++){
now = str[i];
if (all.empty()) all.push(now);
else if (all.top() == '(' && now == ')' || all.top() == '[' && now == ']') all.pop();
else all.push(now);
&...
登录后发布评论
建议用代码插件,语法高亮