#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr int INF = (int)1e9;
constexpr long long LINF = (long long)1e18;
constexpr long long MOD = 1e9 + 7;
//constexpr long long MOD = 998244353;
constexpr double pi = 3.141592653589793238;
 
int main() {
    string s;
    cin >> s;

    string t1, t2;
    bool flag = true;

    for (int i = 0; i < (int)s.size(); ++i) {
        if (s.at(i) == 'R') flag = !flag;
        else {
            if (flag) {
                if (t1.size() == 0) {
                    t1.push_back(s.at(i));
                    t2.push_back(s.at(i));
                    continue;
                }
                if (t1.at(t1.size() - 1) != s.at(i)) {
                    t1.push_back(s.at(i));
                    t2.insert(t2.begin(), s.at(i));
                }
                else {
                    t1.pop_back();
                    t2.erase(t2.begin());
                }
                
            }
            else {
                if (t1.size() == 0) {
                    t1.push_back(s.at(i));
                    t2.push_back(s.at(i));
                    continue;
                }
                if (t2.at(t2.size() - 1) != s.at(i)) {
                    t2.push_back(s.at(i));
                    t1.insert(t1.begin(), s.at(i));
                }
                else {
                    t2.pop_back();
                    t1.erase(t1.begin());
                }
            }
        }
    }
    if (flag) cout << t1 << endl;
    else cout << t2 << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(void){
  string s;
  cin >> s;
  vector<string> subs;
  string tmp = "";
  for(int i = 0; i < s.size() ; ++i){
    if(s[i] != 'R'){
      tmp += s[i];
    }
    else{
      subs.push_back(tmp);
      tmp = "";
    }
    if(i == s.size()-1){
      subs.push_back(tmp);
    }
  }

  string ans = "";
  for(int i=0 ; i < subs.size() ; ++i){
    if((subs.size()-i-1)%2 == 0){
      ans += subs[i];
    }
    else{
      string tmp = subs[i];
      reverse(tmp.begin(), tmp.end());
      ans = tmp + ans;
    }
  }

  vector<char> stack;
  for(int i = 0; i<ans.size() ; ++i){
    if(stack.size() == 0){
      stack.push_back(ans[i]);
      continue;
    }
    if(ans[i] == stack[stack.size()-1]){
      stack.pop_back();
    }
    else{
      stack.push_back(ans[i]);
    }
  }
  
  // output
  for(int i=0; i<stack.size() ; ++i){
    cout << stack[i] << "" ;
  }
  cout << endl;

return 0;
}
