Writer: jjjjj19980806 Description: pclightyear Difficulty: ★★★☆☆
The infinite monkey theorem is one of the famous thought experiment that describe the concept of infinite and probabilities. pclightyear is curious about the correctness of this theorem. He keeps a monkey, named Evan, as a pet so that he can really implement this experiment in his dormitory.
You are hired as the assistant of pclightyear. During the experiment, you will record a sequence of characters representing the keys Evan punches (pclightyear is caring about the polar bears, so he didn’t want to waste any paper or electricity.). After the experiment, it is your job to restore the origin sentence Evan types.
The sequence you records follows the following rules:
1. Character ‘>’ represents that Evan right shifts the cursor. If the cursor is located at the back of the sentence, it does nothing.
2. Character ‘<’ represents that Evan left shifts the cursor. If the cursor is located at the front of the sentence, it does nothing.
3. The capital letter ‘D’ represents that Evan deletes a character. If there is no character after the cursor, it does nothing.
4. The lowercase letter from ‘a’ to ‘z’ represents that Evan types a lowercase character (same as your record).
5. The underline symbol ‘_' represents that Evan types ‘_’.
After Evan types a character, the cursor will locate at the back of the character Evan just type.
Attention:
Memory Limit Exceeded works properly now, the judge will assign the basic memory limit plus additional 8MB for every test case.
Assume a 32MB memory limit, there will be two conditions:
a. The submission use more than 32MB and less than 40MB.
In this case, the submission will get a Memory Limit Exceeded verdict.
b. The submission use more than 40MB.
In this case, the submission will get a Runtime Error verdict.
There is only a single line contains many characters, representing your record after the experiment.
It is guaranteed that:
Please output a line representing the sentence Evan types during the experiment.
NOTICE the memory limit at test case #4.