• + 2 comments

    if(n==1) { st+=str; stk.push(st); } else if(n==1) { st.erase(st.size()-k); stk.push(st); } else if(n==4) { stk.pop(); st=stk.top(); } just reversing the order of changing the string and pushing it on stack is giving segmentation fault in last few cases..please explain