#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define ll long long
//#define file
using namespace std;

int n,m,i,j,k,l;
char f[101][101];
char a[101];

char work(char c1,char c2)
{
	if (c1==c2) return c1;
	if (c1=='R')
	{
		if (c2=='S') return c1;
		return c2;
	}
	if (c1=='P')
	{
		if (c2=='R') return c1;
		return c2;
	}
	if (c1=='S')
	{
		if (c2=='P') return c1;
		return c2;
	}
}

int main()
{
	#ifdef file
	freopen("c.in","r",stdin);
	#endif
	
	scanf("%d%d",&n,&m);
	scanf("%s",a+1);
	fo(i,1,n) f[0][i]=a[i];
	l=1;
	fo(i,1,m)
	{
		fo(j,1,n)
		{
			k=(j+l-1)%n+1;
			f[i][j]=work(f[i-1][j],f[i-1][k]);
		}
		l=l*2%n;
	}
	printf("%c\n",f[m][1]);
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

char solve(string S, int k) {
	assert(!S.empty());
	if (k == 0) return S[0];
	if ((int) S.size() % 2 == 1) S += S;
	assert((int) S.size() % 2 == 0);
	string S2 = "";
	for (int i = 0; i < (int) S.size(); i += 2) {
		if (S[i] == S[i + 1]) {
			S2 += S[i];
		} else {
			pcc H = {min(S[i], S[i + 1]), max(S[i], S[i + 1])};
			if (H == pcc(min('R', 'S'), max('R', 'S'))) {
				S2 += 'R';
			} else if (H == pcc(min('R', 'P'), max('R', 'P'))) {
				S2 += 'P';
			} else {
				S2 += 'S';
			}
		} 
	}
	return solve(S2, k - 1);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	string S;
	cin >> S;
	cout << solve(S, k) << endl;
}
//RPSRPS -> PRS
