• + 1 comment

    @adi7tya & @badal_bokaro if u add st in stk before the while it will work correctlly (means adding empty string in stack) or u can add in case 4;;======= else if(x==4) { s.pop(); if(s.empty()) st=""; else {st=s.top();}}

    i think u will understood the reason of segma. fault