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

int n, m;
int f[105][105], pw[105];
char s[105];

inline int get(char ch)
{
	if(ch == 'P') return 0;
	if(ch == 'R') return 1;
	return 2;
}

inline int check(int a, int b)
{
	if(a == 0) return b == 2 ? 2 : 0;
	if(a == 1) return b == 0 ? 0 : 1;
	return b == 1 ? 1 : 2;
}

int main()
{
	scanf("%d %d", &n, &m);
	scanf("%s", s + 1);

	pw[0] = 1;
	for(int i = 1; i <= m; i++) pw[i] = 2ll * pw[i - 1] % n;

	for(int i = 1; i <= n; i++) f[i][0] = get(s[i]);
	for(int j = 1; j <= m; j++)
		for(int i = 1; i <= n; i++)
			f[i][j] = check(f[i][j - 1], f[ (i - 1 + pw[j - 1]) % n + 1 ][j - 1]);
	
	if(f[1][m] == 0) puts("P");
	if(f[1][m] == 1) puts("R");
	if(f[1][m] == 2) puts("S");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
char str[205],tmp[205];
char F(char x,char y){
	if(x==y)return x;
	if(x=='S'&&y=='P')return x;
	if(x=='P'&&y=='R')return x;
	if(x=='R'&&y=='S')return x;
	return y;
}
int main(){
	cin>>n>>k>>str+1;
	for(int j=1;j<=n;j++)str[j+n]=str[j];
	for(int i=1;i<=k;i++){
		for(int j=1;j<=n;j++)tmp[j]=F(str[2*j-1],str[2*j]);
		for(int j=1;j<=n;j++)str[j]=str[j+n]=tmp[j];
		//for(int j=1;j<=n;j++)cout<<str[j];cout<<endl;
	}
	cout<<str[1];
    return 0;
}
/**/