ans
zhangjinghao
2023-12-09 15:11:19
6
返回题目
#include<bits/stdc++.h>
#define int long long
using namespace std;
//vector<int> a;
//map<string,int> a;
//priority_queue<int, vector<int>, greater<int> > a;
stack<char> a;
signed main(){
string s;
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.empty()||a.top()!='('){
cout<<"Wrong";
return 0;
}
a.pop();
}else if(s[i]==']'){
if(a.empty()||a.top()!='['){
cout<<"Wrong";
return 0;
}
a.pop();
}
}
if(a.empty()){
cout<<"OK";
}else{
cout<<"Wrong";
}
return 0;
}
{{ vote && vote.total.up }}