#include<bits/stdc++.h>
using namespace std;
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sc second
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define fr2(i,a,b) for(int i=a;i>=b;i--)
#define fr3(i,a,b) for(int i=a;i<=b;i++)
#define umap unordered_map<int,int,custom_hash>
#define omap map<int,int>
#define uset unordered_set<int,custom_hash>
#define oset set<int>
#define pr pair<int,int>
#define mod 1000000007
#define mp make_pair
#define all(v) v.begin(),v.end()
#define ppb pop_back

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void read(vec &v)
{
  for(auto &i:v)cin>>i;
}
void solve()
{
  string s;
  cin>>s;
  string ans="";
  bool flip=true;
  for(char i:s)
  {
    if(i=='R')flip^=1;
    else
    {
      if(flip)
      {
        if(ans.empty())
        {
          ans.pb(i);
        }
        else if(ans.back()==i)
        {
          ans.ppb();
        }
        else
          ans.pb(i);
      }
      else
      {
        if(ans.empty())
        {
          string u="";
          u+=i;
          ans.insert(0,u);
        }
        else if(ans.front()==i)
        {
          ans.erase(0,1);
        }
        else
        {
          string u="";
          u+=i;
          ans.insert(0,u);
        }
      }
    }
  }
  if(!flip)reverse(all(ans));
  cout<<ans<<"\n";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    fr3(i,1,t){
      // cout<<"Case #"<<i<<": ";
        solve();
    }
   return 0;
}
// atcoder/zone2021/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  str s;
  while (cin >> s) {
    deque<char> q;
    bool f = true;
    each (c, s) {
      if (c == 'R') f = !f;
      else {
        if (f) q.push_back(c);
        else q.push_front(c);
      }
    }
    str t;
    if (f) {
      while (q.size()) {
        t += q.front();
        q.pop_front();
      }
    } else {
      while (q.size()) {
        t += q.back();
        q.pop_back();
      }
    }

    str u;
    each (c, t) {
      if (u.size() && u.back() == c) u.pop_back();
      else u += c;
    }
    cout << u << endl;
  }

  return 0;
}
