#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

char win(char c1, char c2) {
    if (c1 > c2) swap(c1, c2);
    if (c1 == c2) return c1;
    if (c1 == 'P' && c2 == 'R') return 'P';
    else if (c1 == 'P' && c2 == 'S') return 'S';
    else if (c1 == 'R' && c2 == 'S') return 'R';
}

char dfs(int n, int k, const string &s) {
    map<char, int> mp;
    for (char c : s) ++mp[c];
    if ((int)mp.size() == 1) {
        return s.front();
    } else if ((int)mp.size() == 2) {
        return win(mp.begin()->first, (++mp.begin())->first);
    } else {
        int p2 = 0;
        while ((1<<(p2+1)) <= n) ++p2;
        if (k <= p2) {
            string ss = s.substr(0, 1<<k), tt = "";
            while ((int)ss.size() > 1) {
                for (int i=0; i<(int)ss.size(); i+=2) tt.push_back(win(ss[i], ss[i+1]));
                ss = tt;
                tt = "";
            }
            return ss.front();
        } else {
            int sz = n * (1<<p2);
            string ss = "";
            while ((int)ss.size() < sz) ss += s;
            string tt = "";
            for (int i=0; i<n; ++i) {
                string sss = ss.substr(i*(1<<p2), 1<<p2), ttt = "";
                while ((int)sss.size() > 1) {
                    for (int i=0; i<(int)sss.size(); i+=2) ttt.push_back(win(sss[i], sss[i+1]));
                    sss = ttt;
                    ttt = "";
                }
                tt.push_back(sss.front());
            }
            return dfs(n, k-p2, tt);
        }
    }
}

void solve() {
    int n, k;
    string s;
    cin >> n >> k >> s;

    cout << dfs(n, k, s) << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;

int main() {
  int n,k; string s;
  cin >> n >> k >> s;
  auto f = [](char l,char r){
    if(l=='R'&&r=='P') return r;
    if(l=='S'&&r=='R') return r;
    if(l=='P'&&r=='S') return r;
    return l;
  };
  rep(_,k){
    string t = s;
    s += s;
    rep(i,n) t[i] = f(s[2*i],s[2*i+1]);
    swap(s,t);
  }
  cout << s[0] << endl;
}