Thanks for the ans...But your stack content is wrong..5th stack contains a,T,b,c from bottom to top. Which is invalid ,after b you can not puch c ..here ‘b’ is a handle so viable prefix (Stack contains at any time) can not exist beyond ‘b’ , pop ‘b’ and push ‘T’.