#include<iostream>
#include<string>
#include<stack>
using namespace std;
stack<int> s;
string a;
int main(){
int ok = 1;
cin >> a;
for(int i = 0; i < a.length(); i++){
if(a[i] == '(')
s.push(a[i]);
else if(a[i] == ')'){
if(s.top() == '(')
s.pop();
else{
ok = 0;
break;
}
}
}
if(ok && s.empty()) cout << "YES";
else cout << "NO";
return 0;
}
但是在本地手动输入数据却可以得出正确答案,怎么回事?求大佬解答!谢谢~~