P27934 [洛谷] [Luogu 202406GESP Simulation Level 4] Xiao Su's Keyboard
普及-
题目描述

Problem Description

Xiao Su has a text editor and a peculiar keyboard. This keyboard has 26 lowercase English letters and a backspace key, totaling 27 keys.

Whenever she presses any lowercase English letter key, the corresponding letter is appended to the end of the current text in the editor.
For example, if the current text is luog, pressing the u key will change the text to luogu.

When she presses the backspace key, the editor deletes the last letter of the current text. If the text is empty, nothing happens.
For example, if the current text is luogu, pressing the backspace key will change the text to luog.

Given the sequence of keys Xiao Su presses, starting with an empty text, determine the final text after all the keys are pressed.

Input Format

The first line contains an integer $n$ ($1 \leq n \leq 100$), representing the number of key presses.
The second line contains $n$ space-separated strings, each representing a key press in sequence.

Each string is either a lowercase letter representing the corresponding key, or the string <bs> representing the backspace key.

Output Format

Output a single line containing a string, which is the final text after all the given key presses. The data guarantees that the output is not an empty string.

Sample Input and Output

Sample Input #1

5
a b c d e

Sample Output #1

abcde

Sample Input #2

3
a <bs> b

Sample Output #2

b
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 a b c d e
样例输出
abcde