
#include<cstdio>
using namespace std;
int n,k,calc[200];
int dp[200][200];
char s[200];

inline int dfs(int cur,int p) {
	if(p==0) {
		if(s[cur]=='R')
			return 1;
		else if(s[cur]=='P')
			return 2;
		else if(s[cur]=='S')
			return 3;
	}
	if(dp[cur][p])
		return dp[cur][p];
	int l=dfs(cur,p-1);
	int r=dfs((cur+calc[p-1])%n,p-1);
	int ans;
	if(l==r)
		ans=l;
	else {
		if(l==1) {
			if(r==2) ans=2;
			else ans=1;
		} else if(l==2) {
			if(r==1) ans=2;
			else ans=3;
		} else if(l==3) {
			if(r==1) ans=1;
			else ans=3;
		}
	}
	dp[cur][p]=ans;
	return ans;
}

inline void prework() {
	scanf("%d%d",&n,&k);
	scanf("%s",s);
	calc[0]=1;
	for(int i=1; i<=k; i++)
		calc[i]=calc[i-1]*2%n;
	int op=dfs(0,k);
	if(op==1)
		puts("R");
	else if(op==2)
		puts("P");
	else
		puts("S");
}
int main() {
		prework();
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

char battle(char l_hand, char r_hand)
{
    if ((l_hand == 'R' && r_hand == 'S') || (l_hand == 'P' && r_hand == 'R') || (l_hand == 'S' && r_hand == 'P'))
    {
        return l_hand;
    }
    if ((r_hand == 'R' && l_hand == 'S') || (r_hand == 'P' && l_hand == 'R') || (r_hand == 'S' && l_hand == 'P'))
    {
        return r_hand;
    }
    return l_hand;
}

int main()
{
    int N, K;
    string S;

    cin >> N >> K >> S;

    for (int k = 0; k < K; k++)
    {
        string T = S + S;
        S = "";
        for (int i = 0; i < N * 2; i += 2)
        {
            S += battle(T.at(i), T.at(i + 1));
        }
    }

    cout << S.at(0) << endl;
}
