#include <bits/stdc++.h>
using namespace std;
/*
string r(string s){
  string r;
  
  for(int i=s.size()-1;i>=0;i--){
    r+=s.at(i);
  }
  
  return r;
}
    */
  

int main(){
  string s;
  cin >> s;
  
  string t;
  bool r=false;
  
  for(int i=0;i<s.size();i++){
    if(s.at(i)!='R'){
      if(!r){
        
      if(t=="" || t.at(t.size()-1)!=s.at(i)){
        t+=s.at(i);
      }else{
        t.erase(t.size()-1);
      }
        
      }else{
        
        if(t=="" || t.at(0)!=s.at(i)){
        t=s.at(i)+t;
      }else{
        t.erase(0,1);
      }
        
      }
      
    }else{
      r=!r;
    }
  }
  
  if(r){
    reverse(t.begin(),t.end());
    cout << t <<endl;
  }else{
    cout << t <<endl;
  }
  
}


// Problem: D - Message from Aliens
// Contest: AtCoder - ZONe Energy Programming Contest
// URL: https://atcoder.jp/contests/zone2021/tasks/zone2021_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define pi  3.141592653589793238462643383279
#define int long long
#define lld long double
#define ff first
#define ss second
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define VI vector <int>
#define VVI vector <VI>
#define pii pair<int, int>
#define ppi pair<pii, int>
#define mii map<int, int>
#define mci map<char, int>
#define miv map<int, VI>
#define mis map<int, set<int>>
#define high_functioning_sociopath  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const unsigned int M = 998244353;
/*_____________________________THE GAME IS ON_____________________________*/
void solve()
{
      string s;
      cin >> s;
      int n = s.size();
      deque<char>dq;
      bool off = 0;
      for(int i=0;i<n;i++)
      {
      	  if(s[i]=='R')
      	  {
      	  	  off^=1;
      	  	  continue;
      	  }
      	  if(off==0)dq.push_front(s[i]);
      	  else dq.push_back(s[i]);
      }
      stack<int>st;
      while(!dq.empty())
      {
      	   if(off)
      	   {
      	   	  char x = dq.back();
      	      if(st.empty())st.push(x);
      	      else
      	      {
      	      	 if(st.top()==x)st.pop();
      	      	 else st.push(x);
      	      }dq.pop_back();
      	   }
      	   else
           {
      	         char x = dq.front();
      	         if(st.empty())st.push(x);
      	         else
      	         {
      	      	    if(st.top()==x)st.pop();
      	      	      else st.push(x);
      	         }dq.pop_front();  
           }
      }
      vector<char>v;
      while(!st.empty())
      {
      	  v.pb(st.top());
      	  st.pop();
      }
      for(auto x : v) cout << x;
}
int32_t main()
{
   high_functioning_sociopath
   //pre();
   int t=1;
   //cin>>t;
   while(t--)
   {
      solve();
   }
}