#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, l, n, k, a, b;
  scanf("%lld%lld", &n, &k);
  char s[n + 10], t[n], r[4] = "RPS";
  scanf("%s", s);
  for(j = 0; j < k; ++j) {
    for(i = 0; i < n; ++i) {
      a = (i * 2) % n, b = (i * 2 + 1) % n;
      for(l = 0; l < 3; ++l) if(s[a] == r[l] && s[b] == r[(l + 1) % 3]) {
        t[i] = s[b];
        break;
      }
      if(l == 3) t[i] = s[a];
    }
    for(i = 0; i < n; ++i) s[i] = t[i];
  }
  printf("%c", s[0]);
  return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long ll;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    rep(i, k) {
        string t = "";
        rep(j, n) {
            char c = s[(j * 2) % n], d = s[(j * 2 + 1) % n];
            if (c == d) t.push_back(c);
            else if (c == 'R' && d == 'S') t.push_back(c);
            else if (c == 'P' && d == 'R') t.push_back(c);
            else if (c == 'S' && d == 'P') t.push_back(c);
            else if (c == 'S' && d == 'R') t.push_back(d);
            else if (c == 'R' && d == 'P') t.push_back(d);
            else if (c == 'P' && d == 'S') t.push_back(d);
        }
        s = t;
    }
    cout << s[0] << "\n";
}