First of all, use two stacks to implement the queue. It is necessary to understand that the stack is first in last out, and the queue is first in first out;
Then we use one of the stacks to implement the enqueue operation, and the other one is used to dequeue, that is, one only takes in and one only takes out;
For example, there is a set of numbers [12,23,45,55]; enter 12,23 into s1, and now you want to leave the team, the first one to go out should be 12, then you only need to add all of s1 to s2, In this way, just pop up;
If you want to leave the team, you should first check whether there are any elements in s2. If so, you only need to pop the elements; if you don’t put all the elements in s1 into s2 for popping;