首页 > 其他分享 >链表指针指迷了我(UVA 11988 STL deque)

链表指针指迷了我(UVA 11988 STL deque)

时间:2023-03-08 16:32:38浏览次数:41  
标签:deque end STL text Beiju 链表 key home internally


Broken Keyboard (a.k.a. Beiju Text)

You're typing a long text with a broken keyboard. Well it's not so badly broken. The only problem with the keyboard is that sometimes the "home" key or the "end" key gets automatically pressed (internally).

You're not aware of this issue, since you're focusing on the text and did not even turn on the monitor! After you finished typing, you can see a text on the screen (if you turn on the monitor).

In Chinese, we can call it Beiju. Your task is to find the Beiju text.

Input

There are several test cases. Each test case is a single line containing at least one and at most 100,000 letters, underscores and two special characters '[' and ']'. '[' means the "Home" key is pressed internally, and ']' means the "End" key is pressed internally. The input is terminated by end-of-file (EOF). The size of input file does not exceed 5MB.

Output

For each case, print the Beiju text on the screen.

Sample Input

This_is_a_[Beiju]_text [[]][][]Happy_Birthday_to_Tsinghua_University

Output for the Sample Input

BeijuThis_is_a__text Happy_Birthday_to_Tsinghua_University

题意:一个不规则的文本‘[’表示home键,‘]’表示end键,这里解释一下按下home键是将光标移动到字符首位,end光标放在末尾。(大家可以试验一下,我今天才知道这两个键的用法)。求正确的文本

大概思路知道,就是用链表模拟不出来,好难。。。

标签:deque,end,STL,text,Beiju,链表,key,home,internally
From: https://blog.51cto.com/u_15998011/6108467

相关文章