yes gabbar ryt
but i have doubt there in 1 option that when we explore till a,b,c,f,g now after wards stack contain two element ,top element as e and bottom element as d so how we first print d and than after e as e should be printed first where i am going wrong ?? plz clarify ?? or post ur snapshot using showing stack enteries .