25 lines
674 B
C++
25 lines
674 B
C++
#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;
|
|
} |