#include <iostream>#include <stack>usingnamespacestd;classQueue{public:intsize=0;stack<int>s1;stack<int>s2;// Push element x to the back of queue.voidpush(intx){s1.push(x);size++;}// Removes the element from in front of queue.voidpop(void){if(!s2.empty()){s2.pop();}else{while(!s1.empty()){intt=s1.top();s1.pop();s2.push(t);}s2.pop();}size--;}// Get the front element.intpeek(void){if(!s2.empty()){returns2.top();}else{while(!s1.empty()){intt=s1.top();s1.pop();s2.push(t);}returns2.top();}}// Return whether the queue is empty.boolempty(void){if(size==0){returntrue;}else{returnfalse;}}};