You are viewing a single comment's thread. Return to all comments →
In this problem,by using stack,the basic idea is to store each modified string after the append or delete operation
performed on them.
Now the fourth option is to undo last step on string and as the previous modified(last modified) string must be on the top of stack
so here we have to pop it(st.pop()).After poping,the top of stack will now point that string which it was before performing
the last modification operation (append or delete) on it
and we will now store its present top element in s ie s=st.peek()