#include "bits/stdc++.h"

#define int long long

using namespace std;
using i128 = __int128_t;

random_device rd;
mt19937 gen(rd());

#define random_shuffle(begin, end) shuffle(begin, end, gen)

template <typename T, typename U>
ostream& operator << (ostream& out, const pair <T, U> &p) {
    out << p.first << ": " << p.second;
    return out;
}

template <typename Container>
ostream& print_container(ostream& out, const Container &container, const string &open, const string &close, const string sep=", ") {
    out << open;
    for (const auto &elem : container)
        out << elem << sep;
    out << "\b\b" << close << endl;
    return out;
}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &v) {
    return print_container(out, v, "[", "]");
}

template <typename T>
ostream& operator << (ostream& out, const set<T> &s) {
    return print_container(out, s, "{", "}");
}

template <typename T>
ostream& operator << (ostream& out, const unordered_set<T> &s) {
    return print_container(out, s, "{", "}");
}

template <typename K, typename V>
ostream& operator << (ostream& out, const map<K, V> &s) {
    return print_container(out, s, "{", "}");
}

template <typename K, typename V>
ostream& operator << (ostream& out, const unordered_map<K, V> &s) {
    return print_container(out, s, "{", "}");
}

template<typename... Args>
void writeln(Args... args) {
    ((cout << args << " "), ...);
    cout << endl;
}

namespace std {
    template <typename T, typename U> struct hash<pair <T, U> > { 
        size_t operator()(const pair <T, U> &p) const {
            hash<int> hasher;
            size_t seed = 0;
            seed ^= hasher(p.first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
            seed ^= hasher(p.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
            return seed;
        }
    };  
}

// End of template

int32_t main() {
    ios_base::sync_with_stdio(false);

#ifdef LOCAL_JUDGE
    if (freopen("input.txt", "r", stdin) == NULL) {
        cerr << "Couldn't open file for reading" << endl;
        return 0;
    }
#endif
	string s;
    cin >> s;
    vector <string> q(2);
    int idx = 1;
    for (int i = s.length() - 1; i >= 0; --i) {
        if (s[i] == 'R')
            idx = 1 - idx;
        else
            q[idx].push_back(s[i]);
    }
    reverse(q[1].begin(), q[1].end());
    string t = q[0] + q[1];
    stack <char> st;
    for (char c : t)
        if (st.empty() || st.top() != c)
            st.push(c);
        else
            st.pop();
    string res;
    while (!st.empty()) {
        res.push_back(st.top());
        st.pop();
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
}
#include <bits/stdc++.h>

const long long SZ = 1e5 + 7;
const long long inf = 1e18;
const long long MOD = 1e9 + 7;
const long long mod = 1e9 + 7;
long long opnmbr = 1;

#define ll                  long long
#define ld                  long double

#define pb                  push_back
#define mp                  make_pair
#define eb                  emplace_back

#define pll                 pair<ll, ll>
#define vi                  vector<ll>
#define vs                  vector<string>
#define vpl                 vector<pll>
#define qi                  queue<ll>
#define si                  set<ll>
#define mi                  map<ll, ll>
#define umi                 unordered_map<ll, ll>

#define fi                  first
#define se                  second

#define sz(x)               (ll)x.size()

#define all(c)              (c).begin(), (c).end()
#define allr(c)             (c).rbegin(), (c).rend()

#define Max(a,b)            ((a > b) ? a : b)
#define Min(a,b)            ((a < b) ? a : b)

#define ci(X)               ll X; cin>>X
#define cii(X, Y)           ll X, Y; cin>>X>>Y
#define ciii(X, Y, Z)       ll X, Y, Z; cin>>X>>Y>>Z
#define ciiii(W, X, Y, Z)   ll W, X, Y, Z; cin>>W>>X>>Y>>Z

#define dbg(x)              cout<<#x<<"="<<(x)<<endl;
#define dbg2(x,y)           cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<endl;
#define dbg3(x,y,z)         cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<" "<<#z<<"="<<(z)<<endl;
#define dbg4(x,y,z,w)       cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<" "<<#z<<"="<<(z)<<" "<<#w<<"="<<(w)<<endl;

#define ons()               cout<<"Case #"<<opnmbr++<<": ";
#define krosuru             ll ___T; cin>>___T; while (___T-- > 0)
#define yehbhitheekhai      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define inf                 1e18
#define Endl                endl

#define forn(i, n)          for(ll i = 0; i < (n); i++)
#define fore(i, n)          for(ll i = 1; i <= (n); i++)
#define forl(i, l, r)       for(ll i = l; i < (r); i++)
#define forr(i, l, r)       for(ll i = l; i >= (r); i--)

#define ms0(X)              memset((X), 0, sizeof((X)))
#define ms1(X, V)           memset((X), -1, sizeof((X)))
#define flv(X, V)           fill(all((X)), V)

using namespace std;

ll powermod(ll a, ll b)
{
    ll ans = 1;
    while (b)
    {
        if (b & 1) ans = (ans * a) % MOD;
        b = b / 2;
        a = (a * a) % MOD;
    }
    return ans;
}

ll gcd(ll a, ll b)
{
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}

void krdiyasuru()
{
    string s;
    cin >> s;
    ll n = sz(s);
    string ans = "";
    deque<char> str;
    ll f = 1;
    forn(i, n)
    {
        if(s[i] == 'R')
        {
            f ^= 1;
        }
        else
        {
            if(f == 1)
            {
                str.pb(s[i]);
            }
            else
            {
                str.push_front(s[i]);
            }
        }
    }
    for(auto x: str)
    {
        ans += x;
    }
    if(f == 0)
    {
        reverse(all(ans));
    }
    string a;
    for(auto& c : ans)
    {
        if(sz(a) && a.back() == c)
        {
            a.pop_back();
        }
        else
        {
            a.pb(c);
        }
    }
    cout<<a<<endl;
    return;
}

int main()
{
    yehbhitheekhai;
    //    solve();
    //    krosuru
    {
        krdiyasuru();
    }
}
