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
522 B
25 lines
522 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
//输入+输出重定向
|
||
|
//freopen("../x.in", "r", stdin);
|
||
|
//freopen("../x.out", "w", stdout);
|
||
|
|
||
|
string s;
|
||
|
getline(cin, s);
|
||
|
stack<char> st;
|
||
|
for (int i = 0; i < s.size(); ++i) {
|
||
|
if (s[i] == '(') st.push('(');
|
||
|
if (s[i] == ')') st.pop();
|
||
|
}
|
||
|
|
||
|
if (st.empty()) cout << "YES" << endl;
|
||
|
else cout << "NO" << endl;
|
||
|
//关闭文件
|
||
|
//fclose(stdin);
|
||
|
//fclose(stdout);
|
||
|
return 0;
|
||
|
}
|