Balanced paranthesis program is failing one test case

#include<bits/stdc++.h>
using namespace std;
bool check(string str) {
stack s;
for(int i=0;i<str.size();i++){
char cur = str[i];
if(cur == β€˜(’){
s.push(cur);
}
else if(cur == β€˜)’){
if(s.empty() || s.top()!=’(’){
return false;
}
s.pop();
}
}
return s.empty();
}
int main(){
string s;
cin>>s;
if(check(s)){
cout<<β€œYes”<<endl;
}
else{
cout<<β€œNo”<<endl;
}
}

You are not considering [ ans { brackets

Even considering it also its getting failed

Give ur updated code.

this is failing two test cases

#include<bits/stdc++.h>
using namespace std;
bool check(string str) {
stack s;
for(int i=0;i<str.size();i++){
char cur = str[i];
if(cur == β€˜(’ || cur == β€˜[’){
s.push(cur);
}
else if(cur == β€˜)’ || cur == β€˜]’){
if(s.empty() || s.top()!=’(’ || s.top()!=’[’){
return false;
}
s.pop();
}
}
return s.empty();
}
int main(){
string s;
cin>>s;
if(check(s)){
cout<<β€œYes”<<endl;
}
else{
cout<<β€œNo”<<endl;
}
}