#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
template<class T> void chmax(T& a, T b){
    if(a < b){
        a = b;
    }
}
template<class T> void chmin(T& a, T b){
    if(a > b){
        a = b;
    }
}
int main()
{
    string s;
    cin >> s;
    deque<char>ans;

    bool c = true;
    rep(i,s.size()){
        if(s[i] == 'R')c = !c;
        else{
            if(c){
                if(ans.empty())ans.push_back(s[i]);
                else{
                    if(ans.back() == s[i])ans.pop_back();
                    else ans.push_back(s[i]);
                }
            }

            else{
                if(ans.empty())ans.push_front(s[i]);
                else{
                    if(ans.front() == s[i])ans.pop_front();
                    else ans.push_front(s[i]);
                }
            }
        }
    }

    if(c){
        while(!ans.empty()){
            cout << ans.front();
            ans.pop_front();
        }
    }
    else{
        while(!ans.empty()){
            cout << ans.back();
            ans.pop_back();
        }
    }
    cout << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ll long long
#define pi (3.141592653589)
#define mod 1000000007
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rfo(i, a, b) for (int i = (int)a; i >= (int)b; i--)
#define fo(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define see(x) cout << (x) << endl
#define hh cout << endl
#define INF 1e18
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

template <typename C,
          typename T = std::decay_t<decltype(*begin(std::declval<C>()))>,
          typename std::enable_if<!std::is_same<C, std::string>::value>::type * = nullptr>
std::ostream &operator<<(std::ostream &os, const C &container)
{
    bool first = true;
    std::stringstream ss;
    ss << '[';
    for (const auto &x : container)
    {
        if (!first)
        {
            ss << ", ";
        }
        first = false;
        ss << x;
    }
    ss << ']';
    return os << ss.str();
}
template <class T1, class T2>
std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &p)
{
    os << '{' << p.first << ", " << p.second << '}';
    return os;
}

ll mod_pow(ll a, ll b)
{
    if (b < 0)
        return 0;
    a %= mod;
    if (b == 0)
        return 1;
    if (b == 1)
        return a % mod;
    if (b == 2)
        return ((a % mod) * (a % mod)) % mod;
    return (mod_pow(mod_pow(a, b / 2), 2) * mod_pow(a, b % 2)) % mod;
}

bool isPrime(int n)
{
    if (n == 1)
        return false;
    if (n == 2)
        return true;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

int32_t main()
{
    fast int tc = 1;
    // cin >> tc;
    while (tc--)
    {
        string n, m;
        cin >> n;

        int rot = 0;
        int c = 0;

        deque<char> q;

        fo(i, 0, n.size() - 1)
        {

            if (n[i] == 'R')
            {
                c = 1 - c;
            }
            else
            {

                if (c == 0)
                {

                    if (!q.empty() and q.back() == n[i])
                    {
                        q.pop_back();
                        continue;
                    }
                    q.push_back(n[i]);
                }
                else
                {

                    if (!q.empty() and q.front() == n[i])
                    {
                        q.pop_front();
                        continue;
                    }
                    q.push_front(n[i]);
                }
            }
        }
        // cout << q.pop_back();
        if (c)
        {
            while (!q.empty())
            {
                char c = q.back();
                cout << c;
                q.pop_back();
            }
        }
        else
        {

            while (!q.empty())
            {
                char c = q.front();
                cout << c;
                q.pop_front();
            }
        }
    }
    return 0;
}
