不开心的黑客(ABC 版)AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has $3$ keys on it: the 0 key, the 1 key and the backspace key.
Sig 自己制作了一把键盘。这把键盘追求极致的简洁,只包含 $3$ 个按键:0 键、1 键和退格键。AI (CI翻译)
To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is empty. When each key on the keyboard is pressed, the following changes occur to the string:
首先,他使用这把键盘在一个纯文本编辑器中输入。编辑器始终显示一个字符串(可能为空)。编辑器刚启动时,这个字符串为空。每按下键盘上的一个按键,字符串会发生如下变化:AI (CI翻译)
- The
0key: a letter0will be inserted to the right of the string. - The
1key: a letter1will be inserted to the right of the string. - The backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted.
0键:在字符串右侧插入字符0。1键:在字符串右侧插入字符1。- 退格键:如果字符串为空,则不发生任何变化;否则删除字符串最右侧的字符。
Sig has launched the editor, and pressed these keys several times. You are given a string $s$, which is a record of his keystrokes in order. In this string, the letter 0 stands for the 0 key, the letter 1 stands for the 1 key and the letter B stands for the backspace key. What string is displayed in the editor now?
Sig 启动了编辑器,并按下了若干次这些按键。给定一个字符串 $s$,表示他按键的顺序。其中,字符 0 表示按下 0 键,字符 1 表示按下 1 键,字符 B 表示按下退格键。现在编辑器中显示的字符串是什么?AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1 ≦ |s| ≦ 10$($|s|$denotes the length of$s$)$s$consists of the letters0,1andB.- The correct answer is not an empty string.
$1 ≦ |s| ≦ 10$($|s|$表示$s$的长度)$s$仅由字符0、1和B组成。- 正确答案不为空字符串。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
s
sAI (CI翻译)
Output
输出格式
AI (CI翻译)Print the string displayed in the editor in the end.
输出最终编辑器中显示的字符串。AI (CI翻译)
样例
01B0
00
0BB1
1
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。