#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)


int main(){
    string s;
    cin >> s;
    deque<char> t;
    string ans;
    bool h = false;
    rep(i, s.size()){
        if (s[i] == 'R') h = !h;
        else{
            if (!h) t.push_back(s[i]);
            else t.push_front(s[i]);
        }
    }
    
    if (h){
        reverse(t.begin(), t.end());
    }

    for (char c : t){
        if (ans.size() && ans.back() == c) ans.pop_back();
        else ans.push_back(c);
    }
    cout << ans << endl;
}
	// Author :: <Hitesh_Saini>
	#include<bits/stdc++.h>
	 
	#define __speed() ios_base::sync_with_stdio(false), cin.tie(nullptr);
	#define dbg(x) cout << "(" << __LINE__ << ": "<< #x << " = " << x << ")\n"
	 
	#define Yes(x) puts((x) ? "Yes" : "No")
	#define tt 	int t; for (cin >> t; t--; )
	 
	#define f0(i, n)  for (i = 0; i < (int)(n); i++)
	#define f1(i, n)  for (i = 1; i <=(int)(n); i++)
	 
	#define all(x) x.begin(), x.end()
	#define rall(x) x.rbegin(), x.rend()
	#define sz(x) (int)(x.size())
	 
	#define EB emplace_back
	#define PB push_back

	#define LB lower_bound
	#define UB upper_bound

	#define endl "\n"
	#define S second
	#define F first

	using namespace std;
	using mii = map<int, int>;
	using pii = pair<int, int>;
	 
	using ll = int64_t;
	using vi = vector<int>;
	 
	using vvi = vector<vi>;
	using vl = vector<ll>;
	 
	const pair<int, int> DD[] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
	const int mod = 1e9 + 7, mxN = 2e5 + 5, INF = 0x3f3f3f3f;
	const ll LINF = 0x3f3f3f3f3f3f3f3f;
	 

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

	template <typename T1, typename T2> bool cmax(T1& a, T2 b) { if (b > a) { a = b; return true; } return false; }
	template <typename T1, typename T2> bool cmin(T1& a, T2 b) { if (b < a) { a = b; return true; } return false; }

	template <typename T> istream& operator>>(istream& in, vector<T>& v) { for (T& x:v) in >> x; return in; }
	template <typename T> ostream& operator<<(ostream& ot, vector<T>& v) { for (T& x:v) ot << x << ' '; return ot;}





	void solve() {
		int n, d, h, i, j;
		string s;
		cin >> s;
		n = sz(s);
		deque<char> ans;
		int x = 1;
		for (char z : s) {
			if (z == 'R')
				x ^= 1;
			else {
				if (x) {
					if (sz(ans) && ans.back() == z)
						ans.pop_back();
					else
						ans.push_back(z);
				} else {
					if (sz(ans) && ans.front() == z)
						ans.pop_front();
					else
						ans.push_front(z);
				}
			}
		}
		// ans.erase(unique(all(ans)), ans.end());
		if (!x) reverse(all(ans));
		for (char x : ans) cout << x;
	}






























	signed main() { 
		cout << fixed << setprecision(12);

		__speed() solve();
		 // int t, i; for (cin >> t, i = 1; i <= t; i++) cout << "Case #" << i << ": ", solve();
	}