Files
python/LuoGu/RuMen/P1739.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

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;
}