TIJIE
2024-02-17 11:48:46
发布于:广东
0阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
string s;
stack<int>st;
int main()
{
cin>>s;
int i=0,top=0,flag=0;
while(s[i]!='@')
{
if(s[i]=='(') top++;
if(s[i]==')') top--;
if(top<0)
{
flag=1;
break;
}
i++;
}
if(top!=0) flag=1;
if(flag==0) cout<<"YES";
else cout<<"NO";
}
这里空空如也
有帮助,赞一个