#include <bits/stdc++.h>
#define _max(x, y) ((x > y) ? x : y)
#define _min(x, y) ((x < y) ? x : y)
using namespace std;
typedef long long ll;
template <typename T>
inline void red(T &x)
{
    x = 0;
    bool fg = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            fg ^= 1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
        x = (x << 1) + (x << 3) + (T)(ch ^ 48), ch = getchar();
    if (fg)
        x = -x;
}
template <typename T>
bool umax(T &x, T y) { return (x < y) ? (x = y, true) : (false); }
template <typename T>
bool umin(T &x, T y) { return (x > y) ? (x = y, true) : (false); }
const int N = 109;
int n, k, jump[N][N];
char s[N];
struct rec
{
    char c;
    rec operator*(const rec y)
    {
        if (c == y.c)
            return *this;
        if (c == 'P')
        {
            if (y.c == 'R')
                return *this;
            else
                return y;
        }
        if (c == 'S')
        {
            if (y.c == 'R')
                return y;
            else
                return *this;
        }
        if (c == 'R')
        {
            if (y.c == 'P')
                return y;
            else
                return *this;
        }
    }
} dp[N][N];

int main()
{
    red(n);
    red(k);
    scanf("%s", s);
    for (int i = 0; i < n; ++i)
    {
        jump[i][0] = (i + 1) % n;
        dp[i][0].c = s[i];
    }
    for (int j = 1; j <= k; j++)
    {
        for (int i = 0; i < n; ++i)
        {
            jump[i][j] = jump[jump[i][j - 1]][j - 1];
            dp[i][j] = dp[i][j - 1] * dp[jump[i][j - 1]][j - 1];
        }
    }
    printf("%c\n", dp[0][k].c);
    return 0;
}
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

char win(char a,char b){
    if (a == 'R' && b == 'P') return b;
    if (a == 'P' && b == 'S') return b;
    if (a == 'S' && b == 'R') return b;
    else return a;
}
int main(){
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    while(k--){
        s += s;
        string t;
        for(int i = 0;i<2*n;i+= 2){
            t += win(s[i],s[i+1]);
        }
        s = t;
    }
    cout << s[0] << endl;

    }
