P27507 [AtCoder] Message from Aliens
普及-
题目描述

Problem Statement

You are given a ciphertext S. It can be decrypted by the following procedure:

  • Let T be an empty string.
  • For each $i = 1, 2, \dots, |S|$ in this order, do the following: (|S| denotes the length of S)
  • if the i-th character of S is R, reverse T;
  • if the i-th character of S is not R, add that character to the end of T.

  • After the operation above, if there are two consecutive same characters in T, 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 T obtained by this procedure.

Input

Input is given from Standard Input in the following format:
S

Output

Print the answer.

Constraints

  • S consists of lowercase English letters and R.
  • 1 ≤ |S| ≤ $5 \times 10^5$

Sample Input 1

ozRnonnoe

Sample Output 1

zone

We can decrypt it as follows:

  • Initially, T is an empty string.
  • Add o at the end of T, making it o.
  • Add z at the end of T, making it oz.
  • Reverse T, making it zo.
  • Add n at the end of T, making it zon.
  • Add o at the end of T, making it zono.
  • Add n at the end of T, making it zonon.
  • Add n at the end of T, making it zononn.
  • Add o at the end of T, making it zononno.
  • Add e at the end of T, making it zononnoe.
  • Delete two consecutive ns from T, making it zonooe.
  • Delete two consecutive os from T, making it zone.

Sample Input 2

hellospaceRhellospace

Sample Output 2

The answer may be an empty string.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
ozRnonnoe
样例输出
zone