posted 4 years ago
Please check Line 66. You initialized your 2nd stack of size 8. You pushed 8 numbers in it and when its time to pop them you are running loop from 0 to 5. Change your loop condition for second stack output and you should have desired output.