#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
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 (b<a) { a=b; return 1; } return 0; }
int main(){
  char a[3];
  cin>>a[0]>>a[1]>>a[2];
  cout << a[1] << a[2] << a[0] << endl;
  return 0;
}
#include <stdio.h>

int main(){
  bool rev=false;
 	char dq[1101000],c;
  int l=501000,r=501000;//一開一閉
  while((c=getchar())!='\n'){
  	if(c=='R')rev=!rev;
    else{
    	if(rev){
        if(l!=r&&dq[l]==c)l++;
        else dq[--l]=c;}
      else{
        if(l!=r&&dq[r-1]==c)r--;
        else dq[r++]=c;}}}
	if(rev)for(int i=r-1;i>=l;i--)putchar(dq[i]);
  else for(int i=l;i<r;i++)putchar(dq[i]);
	putchar('\n');
return 0;}