Issue #5
    using a stack and a queue to solve the problem