sgu 397 TextEditor

397. Text Editor
Time limit per test: 8 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



The simplest text editor "Open Word" allows to create and edit only one word. The editor processes keys 'a' -- 'z', and also 'L' (to the left) and 'R' (to the right). After starting his work the editor immediately creates an empty word and sets its cursor to the left-most position. When one of keys 'a' -- 'z' is pressed, the text editor inserts corresponding symbol just after the cursor. After that a cursor moves one position to the right in such a way that it is placed just after new symbol. When key 'L' or 'R' is pressed, the cursor moves one position to the left or to the right respectively. If the cursor can't be moved because it is placed at the left-most or right-most position the command is ignored. Developers of "Open Word" didn't think about the effectiveness so the editor is working slowly if a lot of keys have been pressed.

Your task is to write a program that can process a sequence of key pressings emulating this editor and output result string.

Input

The input file contains one string which consists of symbols ' ' -- ' ', ' ' and ' '. The string length is not less than 1 and doesn't exceed .

Output

Write a required string to the output file.

Example(s)
sample input
sample output
abLcd
acdb

 

sample input
sample output
icpLLLLLacmRRRRRRRRRRRRc
acmicpc


这个题目题意很简单,就是要写一个支持插入,左移光标,右移光标操作的文本编辑器,用双向链表就可以完美解决。但是我一开始用scanf("%s",str)将字符串都读入来再处理,就TLE on test54 后来改为读一个字符就处理一个字符,就AC了 ,966ms 汗一个-.-b

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值