#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using vi = vector<int>; 
using vll = vector<long long>; 
using vb = vector<bool>;
using vd = vector<double>;
using vc = vector<char>;
using vvi = vector<vector<int>>; 
using vvll = vector<vector<long long>>;
using vvc = vector<vector<char>>;
using pii = pair<int,int>; 
using pll = pair<ll,ll>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using graph = vector<vector<pair<T, int>>>;// pair of weight and vertex
void my_answer(){

   string s;
   cin >> s;

   deque<char> t;

   int turn = 1;
   for(const auto c: s){
       if(c == 'R'){
           turn *= -1;
           continue;
       }
       
       if(turn == 1){
           if(!t.size()) t.emplace_back(c);
           else if(t.back() != c) t.emplace_back(c);
           else t.pop_back();
       }else{
           if(!t.size()) t.emplace_front(c);
           else if(t.front() != c) t.emplace_front(c);
           else t.pop_front();
       }
   }

   if(turn == 1){
       for(auto itr = t.begin(); itr != t.end(); ++itr){
           cout << *itr;
       }
   }else{
       for(auto itr = t.rbegin(); itr != t.rend(); ++itr){
           cout << *itr;
       }
   }
   cout << endl;

}
void best_answer(){
   
}
int main(){

    my_answer();
    // best_answer();
}

#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <stack>
#include <cstring>
#include <set>
#include <utility>
#include <iostream>
#include <iomanip>
#include <list>
#include <queue>
#include <algorithm>
#include <cmath>
//#include <boost/multiprecision/cpp_int.hpp>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <numeric>
#include <complex>
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define SUM(v) accumulate(ALL(v),0ll)
using ll = long long;
const ll INF=100;
const ll eps=1;
const double pi=3.14159265359;
const ll mod=1000000+7;
using namespace std;
int main()
{
  string s;
  cin>>s;
  int len=s.size();
  string t;
  bool ok=true;
  for(int i=0;i<len;i++)
  {
    if(s[i]=='R')
    {
   //   reverse(t.begin(),t.end());
      if(ok==true)ok=false;
      else ok=true;
    }
    else
    {
      if(ok==true)
        {
          t+=s[i];
          if(t.size()>=2)
          {
            if(t[t.size()-2]==t[t.size()-1])t.erase(t.size()-2,2);
          }

        }
      else
      {
          t=s[i]+t;
          if(t.size()>=1)
          {
            if(t[1]==t[0])t.erase(0,2);
          }
      } 
    }
  }
  if(ok==false)reverse(t.begin(),t.end());
  cout<<t<<endl;
  return 0;
}