题解
2024-10-04 11:42:28
发布于:江苏
0阅读
0回复
0点赞
#include<iostream>
#include<stack>
using namespace std;
stack<char> s;
string q;
int main(){
cin>>q;
for(int i=0;q[i]!='@';i++){
if(q[i]'('){
s.push('(');
}
else if(q[i]')')
{
if(s.empty()){
cout<<"NO";
return 0;
}
else
{
s.pop();
}
}
}
if(s.empty())
cout<<"YES";
else
cout<<"NO";
return 0;
}
这里空空如也
有帮助,赞一个