Balanced paranthese check

why my code give wrong answer output are correct

you have consider only one bracket which is ( but there are some as well

You are given a string of brackets i.e. β€˜{’, β€˜}’ , β€˜(’ , β€˜)’, β€˜[’ , β€˜]’ .

also take these into consideration

sir magar ye walaa code jo nicche hai ushme input ye kyu nai chal raha hai (()))

this is correct one
if stack is empty you can’t access it’s top it will give you segmentation fault

so first check stack is not empty

sir its failling two test case now

in case of closing braces you have to check indivisualy

if arr[i]==}
then s.top() should be { only
( ,[ they are not allowed

so you have to check condition one by one you can’t write it in just one condition

also at line 11 correct way of writing is

if(a[i]=='('||a[i]=='{'||a[i]=='[')
    {

modified Code