#include <bits/stdc++.h>
using namespace std;

//.define
// #define FILE_IN_OUT
#define RET(_x)    return cout << (_x) << '\n', 0;
#define all(_obj)  (_obj).begin(), (_obj).end()
#define loop(_n)   for (int i = 0; i < (_n); ++i)
#define sz(_obj)   static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)  std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)  {}
#endif
#define endl "\n"
template<typename P, typename Q>
P CeilDiv(P _dividend, Q _divider) {
    return static_cast<P>((_dividend - 1LL + _divider) / _divider);
}
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll = int64_t;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<int>(1e9 + 7);

//.data
constexpr int MAXN = 105;

char dp[MAXN][MAXN];

bool Win(char a, char b) {
    if (a == b) {
        return true;
    }
    if (a == 'R') {
        return b == 'S';
    }
    if (a == 'P') {
        return b == 'R';
    }
    return b == 'P';
}

int Mul(int x, int y, int mod) {
    return int(1LL * x * y % mod);
}

int Add(int x, int y, int mod) {
    x += y;
    return x < mod ? x : x - mod;
}

int FastPow(int x, int p, int mod) {
    int res = 1;
    while (p > 0) {
        if (p & 1) {
            res = Mul(res, x, mod);
        }
        p >>= 1;
        x = Mul(x, x, mod);
    }
    return res;
}

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n, k;
    string s;
    cin >> n >> k >> s;
    loop(n) {
        dp[0][i] = s[i];
    }
    for (int i = 1; i <= k; ++i) {
        for (int j = 0; j < n; ++j) {
            int x = FastPow(2, i - 1, n);
            dp[i][j] = Win(dp[i - 1][j], dp[i - 1][Add(j, x, n)]) ? dp[i - 1][j] : dp[i - 1][Add(j, x, n)];
        }
    }
    cout << dp[k][0] << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}
#include <iostream>
#include <vector>
#include <math.h>
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

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

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

    // R .. グー P .. パー S .. チョキ
    string t = s + s;
    rep(a, k){
        string t = s + s;
        for(int i = 0; i < n; i++){
            if(t[i*2] == 'R' and t[i*2+1] == 'R'){
                s[i] = 'R';
            }else if(t[i*2] == 'R' and t[i*2+1] == 'P'){
                s[i] = 'P';
            }else if(t[i*2] == 'R' and t[i*2+1] == 'S'){
                s[i] = 'R';
            }else if(t[i*2] == 'P' and t[i*2+1] == 'R'){
                s[i] = 'P';
            }else if(t[i*2] == 'P' and t[i*2+1] == 'P'){
                s[i] = 'P';
            }else if(t[i*2] == 'P' and t[i*2+1] == 'S'){
                s[i] = 'S';
            }else if(t[i*2] == 'S' and t[i*2+1] == 'R'){
                s[i] = 'R';
            }else if(t[i*2] == 'S' and t[i*2+1] == 'P'){
                s[i] = 'S';
            }else if(t[i*2] == 'S' and t[i*2+1] == 'S'){
                s[i] = 'S';
            }
        }
    }
    cout << s[0] << endl;
}