Description

Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward. In this problem, you are asked to implement this. 
The following commands need to be supported: 
BACK: Push the current page on the top of the forward stack. Pop the page from the top of the backward stack, making it the new current page. If the backward stack is empty, the command is ignored. 
FORWARD: Push the current page on the top of the backward stack. Pop the page from the top of the forward stack, making it the new current page. If the forward stack is empty, the command is ignored. 
VISIT : Push the current page on the top of the backward stack, and make the URL specified the new current page. The forward stack is emptied. 
QUIT: Quit the browser. 
Assume that the browser initially loads the web page at the URL http://www.acm.org/

Input

Input is a sequence of commands. The command keywords BACK, FORWARD, VISIT, and QUIT are all in uppercase. URLs have no whitespace and have at most 70 characters. You may assume that no problem instance requires more than 100 elements in each stack at any time. The end of input is indicated by the QUIT command.

Output

For each command other than QUIT, print the URL of the current page after the command is executed if the command is not ignored. Otherwise, print "Ignored". The output for each command should be printed on its own line. No output is produced for the QUIT command.

Sample Input

VISIT http://acm.ashland.edu/
VISIT http://acm.baylor.edu/acmicpc/
BACK
BACK
BACK
FORWARD
VISIT http://www.ibm.com/
BACK
BACK
FORWARD
FORWARD
FORWARD
QUIT

Sample Output

http://acm.ashland.edu/
http://acm.baylor.edu/acmicpc/
http://acm.ashland.edu/
http://www.acm.org/
Ignored
http://acm.ashland.edu/
http://www.ibm.com/
http://acm.ashland.edu/
http://www.acm.org/
http://acm.ashland.edu/
http://www.ibm.com/
Ignored

POJ 1028题目描述的更多相关文章

  1. POJ 1035题目描述

    Description You, as a member of a development team for a new spell checking program, are to write a ...

  2. poj 动态规划题目列表及总结

    此文转载别人,希望自己能够做完这些题目! 1.POJ动态规划题目列表 容易:1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 11 ...

  3. POJ 动态规划题目列表

    ]POJ 动态规划题目列表 容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276, 1322 ...

  4. poj 1028

    http://poj.org/problem?id=1028 题意(水):做一个游览器的历史记录. back:后退到上一个页面,当上一个页面没有时,输出ignored. forward:向前一个页面, ...

  5. poj 1028 Web Navigation(模拟)

    题目链接:http://poj.org/problem? id=1028 Description Standard web browsers contain features to move back ...

  6. poj 1028 Web Navigation 【模拟题】

    题目地址:http://poj.org/problem?id=1028 测试样例: Sample Input VISIT http://acm.ashland.edu/ VISIT http://ac ...

  7. {POJ}{动态规划}{题目列表}

    动态规划与贪心相关: {HDU}{4739}{Zhuge Liang's Mines}{压缩DP} 题意:给定20个点坐标,求最多有多少个不相交(点也不相交)的正方形 思路:背包问题,求出所有的正方形 ...

  8. poj 1028 Web Navigation

    Web Navigation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 31088   Accepted: 13933 ...

  9. POJ动态规划题目列表

    列表一:经典题目题号:容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1191,1208, 1276, 13 ...

随机推荐

  1. ASCII Table - ASCII码对照表

    ASCII控制字符 二进制 十进制 十六进制 缩写 可以显示的表示法 名称/意义 0000 0000 0 00 NUL ␀ 空字符(Null) 0000 0001 1 01 SOH ␁ 标题开始 00 ...

  2. DTD约束的校验工具安装及检验(Iexmltls工具)

    通过打开我们写的dtd约束文档,我们可以看到,在我们不按规定的格式打开xml时并不能检验出错误.此时我们可以借助软件来帮助我们校验. Iexmltls是一个在IE浏览器下安装的用于检验xml约束是否正 ...

  3. css margin居中的问题

    1.要在外壳套上一个父div加上100%宽度,在子div加上宽度和margin:auto; 2.子div的宽度通常是子div中元素的宽度,比如子div中一个宽度为169px的input.想居中的话,就 ...

  4. 让VIEWSTATE从页面中完全消失(小技巧)

      VIEWSTATE是个好东西,是asp.net的一大创举,给web开发带来了极大的便利,然后这种便利是一种双刃剑,尤其是在前台页面,大多数前台页面都是用来展示列表数据,和用户交互的地方现在大都采用 ...

  5. Symantec Liveupdate Administrator的搭建

      1. My Symantec Products 选择需要更新的产品 2. Source Servers 选择ftp, 下载比较稳定 3. Distribute Center 类似于WSUS中的ap ...

  6. SonarQube代码质量管理平台安装与使用

    Sonar简介 Sonar是一个用于代码质量管理的开源平台,用于管理源代码的质量,可以从七个维度检测代码质量 通过插件形式,可以支持包括java,C#,C/C++,PL/SQL,Cobol,JavaS ...

  7. YII 查找View的5种方式

    别名开头,路径指定view文件@app/views/site/about.php //开头,使用 app目录下面的views//site/about.php /开头,使用当前Module中的views ...

  8. C#中String.Empty,“”,NULL的区别

    一.String.Empty String类的静态只读字段.定义如下: public static readonly string Empty; 二.“” 被赋值为“”的字符串变量,会在栈上保存一个地 ...

  9. Apache Spark源码走读之19 -- standalone cluster模式下资源的申请与释放

    欢迎转载,转载请注明出处,徽沪一郎. 概要 本文主要讲述在standalone cluster部署模式下,Spark Application在整个运行期间,资源(主要是cpu core和内存)的申请与 ...

  10. Nginx 笔记与总结(1)编译安装

    Nginx 可以承受 3 万并发连接数,Apache 默认最大连接数是 256 个. 编译安装 ① 下载 在 Nginx 的主页 http://nginx.org/ 下载最新的 stable vers ...