文章
37
粉丝
98
获赞
4
访问
21.7k
#include<iostream>
#include<algorithm>
#include<stack>
#include<string>
using namespace std;
int main()
{
string s;
while (cin >> s) {
stack<char> stac;
int len = s.size();
for (int i = 0; i < len; i++) {
if (!stac.empty()) {
char now = stac.top();
if ((s[i] == ')' && now == '(') || (s[i] == ']' && now == '[') || (s[i] == '}' && now == '{') || (s[i] == '>' && now == '<')) {//匹配成功,出栈
 ...
登录后发布评论
暂无评论,来抢沙发