AOJ 10032 - Stacking Block I

空白を含むときはgetlineをつかおう.

#include<iostream>
#include<stack>
#include<queue>

int main(){
	std::string command;
	std::stack<char> stack; 
	std::queue<char> p_queue;
	while(std::cin >> command, command != "quit"){
		char argument;
		if(command == "pop"){
			p_queue.push(stack.top());
			stack.pop();
		}else if(command == "push"){
			std::cin >> argument;
			stack.push(argument);
		}
	}
	while(!p_queue.empty()){
		std::cout << p_queue.front() << std::endl;
		p_queue.pop();
	}
	return 0;
}