wangjiajian • 2年前
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
using namespace std;
const int N = 260;
char bds[N];
stack<char> s;
int main(){
scanf("%s",bds);
int i=0;
while(bds[i] != '@'){
if(bds[i] == '(')
s.push('(');
else if(bds[i] == ')'){
if(s.size() != 0)
s.pop();
else{
printf("NO");
return 0;
}
}
i++;
}
if(s.size() == 0)
printf("YES");
else
printf("NO");
return 0;
}
评论: