题解
2023-08-31 22:47:47
发布于:江苏
0阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
stack <char> stk;
int main(){
string s;
cin>>s;
for(int i=0;i<s.length();i++){
if(s[i]=='@'){
break;
}else if(s[i]=='('){
stk.push('(');
}else if(s[i]==')'){
if(!stk.empty()){
stk.pop();
}else if(stk.empty()){
cout<<"NO";
return 0;
}
}
}
if(stk.empty()){
cout<<"YES";
}else{
cout<<"NO";
}
return 0;
}
这里空空如也
有帮助,赞一个