You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
650 B

#include <bits/stdc++.h>
using namespace std;
stack<char> _a;
int main() {
ios::sync_with_stdio(false); //读入输出优化的强迫症
string str = "";
cin >> str;
for (int i = 0; i < str.size(); i++) {
if (str[i] == '@') break;
if (str[i] == '(') _a.push(str[i]);
if (str[i] == ')') {
if (!_a.empty()) {
_a.pop();
} else {
cout << "NO" << endl;
return 0;
}
}
}
if (_a.empty()) cout << "YES" << endl;//判断有没有多余的(
else cout << "NO" << endl;//也就是判断栈是否为空
return 0;
}