bool isValid(string s) {
stack<int> sta;
if(s.size()%2!=0){
return false;
}
for(int i=0;i<s.size();i++){
if(sta.empty()){
sta.push(s[i]);
}
else if((sta.top()=='('&&s[i]==')')||(sta.top()=='['&&s[i]==']')||(sta.top()=='{'&&s[i]=='}')){
sta.pop();
}else
{
sta.push(s[i]);
}
}
if(sta.empty()){
return true;
}
return false;
}