#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,b,c) for(int (i)=a;(i)<=b;(i)+=c)
string S;
deque<char> ans;
bool op;
int main() {
    cin>>S;
    int L=S.size();
    fo(i,0,L-1,1) {
        if(S[i]=='R') op^=1;
        else {
            if(op) {
                if(ans.size()&&ans.front()==S[i]) ans.pop_front();
                else ans.push_front(S[i]);
            }
            else {
                if(ans.size()&&ans.back()==S[i]) ans.pop_back();
                else ans.push_back(S[i]);
            }
        }
    }
    if(op) {
        while(ans.size()) {
            cout<<ans.back();
            ans.pop_back();
        }
    }
    else {
        while(ans.size()) {
            cout<<ans.front();
            ans.pop_front();
        }
    }
}
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define TIN(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
#define VIND(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem,--_elem
#define OUT(x) cout << (x);
#define OUTL(x) cout << (x) << endl;
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

void solve()
{
    TIN(string, s);
    deque<char> d;
    bool rev = false;
    rep(i, s.size()) {
        if (s[i] == 'R') rev = !rev;
        else {
            if (rev) {
                if (!d.empty() && d.front() == s[i]) d.pop_front();
                else d.push_front(s[i]);
            } else {
                if (!d.empty() && d.back() == s[i]) d.pop_back();
                else d.push_back(s[i]);
            }
        }
    }
    string t(d.begin(), d.end());
    if (rev) reverse(t.begin(), t.end());
    OUTL(t);
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}