提交记录:https://www.luogu.com.cn/record/99224998
#include<bits/stdc++.h>
using namespace std;
stack<char>a;
int main(){
char m;
while(m!='@'){
cin>>m;
if(m=='('){
a.push(m);
}else if(m==')'&&a.top()=='('){
a.pop();
}
}
if(a.size()==0){
cout<<"YES";
}else{
cout<<"NO";
}
return 0;
}
用栈做的