信奥一本通1354,第五个点运行错误
#include<bits/stdc++.h>
using namespace std;
stack<char> a;
string s;
int main()
{
cin>>s;
for(int i=0;i<s.size();i++){
if(s[i]=='('||s[i]=='[')a.push(s[i]);
else{
if(s[i]==')')
if(a.top()=='(')a.pop();
else{
cout<<"Wrong"<<endl;
return 0;
}
else if(s[i]==']')
if(a.top()=='[')a.pop();
else{
cout<<"Wrong"<<endl;
return 0;
}
}
}
if(a.empty()==false)cout<<"Wrong"<<endl;
else cout<<"OK"<<endl;
return 0;
}