#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  stack<char> s;
  int d = 0, r = 0;
  vector<char> values;
  for (int i = 0; i < n; i += 1) {
    char ch;
    cin >> ch;
    if (ch == 'D') r++;
    if (ch == 'R') d++;
    s.push(ch);
    while (d > 0 && s.top() == 'D') {
      s.pop();
      r--;
      d--;
      if (s.size() == 0) break;
    }
    while (r > 0 && s.top() == 'R') {
      s.pop();
      d--;
      r--;
      if (s.size() == 0) break;
    }
  }
  while (s.size() > 0) {
    values.push_back(s.top());
    s.pop();
  }
  while (true) {
    reverse(values.begin(), values.end());
    for (int i = 0; i < values.size(); i += 1) {
      char ch = values[i];
      if (ch == 'D') r++;
      if (ch == 'R') d++;
      s.push(ch);
      while (d > 0 && s.top() == 'D') {
        s.pop();
        r--;
        d--;
        if (s.size() == 0) break;
      }
      while (r > 0 && s.top() == 'R') {
        s.pop();
        d--;
        r--;
        if (s.size() == 0) break;
      }
    }
    if (s.size() == 1) {
      cout << s.top() << endl;
      break;
    }
    values.clear();
    int sz = s.size();
    int cnt_D = 0, cnt_R = 0;
    while (s.size() > 0) {
      if (s.top() == 'D') cnt_D++;
      if (s.top() == 'R') cnt_R++;
      values.push_back(s.top());
      s.pop();
    }
    if (sz == cnt_R) {
      cout << "R" << endl;
      break;
    } else if (sz == cnt_D) {
      cout << "D" << endl;
      break;
    }
  }
}
