#include<iostream>
#include<stack>
using namespace std;
class myQueue{
private:
stack<char> push_s;
stack<char> pop_s;
public:
void push(char c){
push_s.push(c);
}
void pop(){
if(pop_s.empty()){
while(!push_s.empty()){
pop_s.push(push_s.top());
push_s.pop();
}
}
pop_s.pop();
}
char top(){
char c;
if(pop_s.empty()){
while(!push_s.empty()){
pop_s.push(push_s.top());
push_s.pop();
}
}
// try{
// c = pop_s.top();
// }catch(exception &e){
// cout << "q is empty " << endl;
// // cout << e.what() << endl;
// }
return c;
}
int size(){
return push_s.size() + pop_s.size();
}
};
int main(){
myQueue q;
cout <<"init ,the q size " << q.size() << endl;
q.push('a');
q.push('b');
q.push('c');
cout << "push three time, the size " << q.size() << endl;
cout << "top the char is " << q.top() << endl;
q.pop();
cout << "pop one time ,top the char is " << q.top() << endl;
q.pop();
cout << "pop one time ,top the char is " << q.top() << endl;
q.pop();
q.top();
// if(q.size() == 0)
// cout << "queue is empty" << endl;
return 0;
}