#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,k;
  string s;
  char win[222][222];
  win['R']['S']=win['S']['R']=win['R']['R']='R';
  win['S']['P']=win['P']['S']=win['S']['S']='S';
  win['P']['R']=win['R']['P']=win['P']['P']='P';
  cin>>n>>k>>s;
  
  while(k--){
    const auto t=s+s;
    for(int i=0;i<n*2;i+=2){
      s[i/2]=win[t[i]][t[i+1]];
    }
  }
  cout<<s[0];
}
#include<bits/stdc++.h>
#define ll long long
#define re register
#define INF 2147483647
using namespace std;

inline int read()
{
	int f=1,x=0;char s=getchar();
	while(s<'0'||s>'9')
	{
		if(s=='-') f=-1;
		s=getchar();
	}
	while(s>='0'&&s<='9')
	{
		x=x*10+s-48;
		s=getchar();
	}
	return f*x;
}

inline char cmp(char a,char b)
{
	if(a==b) return a;
	if(a=='R')
	{
		if(b=='P') return b;
		else return a;
	}
	if(a=='P')
	{
		if(b=='S') return b;
		else return a; 
	}
	if(a=='S')
	{
		if(b=='R') return b;
		else return a;
	}
}

char s[105],f[105][105];
int nxt[105][105];

int main()
{
	int n=read(),k=read();
	scanf("%s",s);
	for(int i=0;i<n;i++) 
	{
		nxt[i][1]=(i+1)%n;
		//cout<<nxt[i][1]<<endl;
		f[i][1]=cmp(s[nxt[i][1]],s[i]);
		//putchar(f[i][1]);
		//puts("");
	}
	for(int j=2;j<=k;j++)
	{
		for(int i=0;i<n;i++)
		{
			nxt[i][j]=nxt[(nxt[i][j-1]+1)%n][j-1];
			f[i][j]=cmp(f[i][j-1],f[(nxt[i][j-1]+1)%n][j-1]);
			//cout<<nxt[i][j]<<endl;
		}	
	}
	putchar(f[0][k]);
	return 0;
}