代码
#include<iostream>
#include<stack>
using namespace std;
stack<char>s;
char ch;
int main(){
while((ch=getchar())!='@'){
if(ch=='(')
s.push('(');
if(ch==')'){
if(s.top()=='(')
s.pop();
else
s.push(')');
}
}
if(!s.size()==0)cout<<"NO";
else cout<<"YES";
return 0;
}
悬赏关注