#ZONE2021D. 宇宙人からのメッセージ
宇宙人からのメッセージ
Score : points
Problem Statement
You are given a ciphertext . It can be decrypted by the following procedure:
- Let be an empty string.
- For each in this order, do the following: ( denotes the length of )- if the -th character of is
R, reverse ;- if the -th character of is not
R, add that character to the end of .
- if the -th character of is not
- if the -th character of is
R, reverse ; - if the -th character of is not
R, add that character to the end of . - After the operation above, if there are two consecutive same characters in , remove those two characters. Repeat this operation as long as it can be done. (We can prove that the final string obtained does not depend on the order the characters are removed.)
Print the string obtained by this procedure.
Constraints
- consists of lowercase English letters and
R.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
ozRnonnoe
zone
We can decrypt it as follows:
- Initially, is an empty string.
- Add
oat the end of , making ito. - Add
zat the end of , making itoz. - Reverse , making it
zo. - Add
nat the end of , making itzon. - Add
oat the end of , making itzono. - Add
nat the end of , making itzonon. - Add
nat the end of , making itzononn. - Add
oat the end of , making itzononno. - Add
eat the end of , making itzononnoe. - Delete two consecutive
ns from , making itzonooe. - Delete two consecutive
os from , making itzone.
hellospaceRhellospace
The answer may be an empty string.