#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int n,k;
char c[110];
signed main(){
    n=read(),k=read();
    cin>>(c+1);
	for(int i=1;i<=k;i++) {
	 	for(int j=n+1;j<=2*n;j++) c[j]=c[j-n];
		for(int j=1;j<=n;j++) {
			if(c[j*2-1]=='S'){
				if(c[j*2]=='R') c[j]=c[j*2];
				else c[j]=c[j*2-1];
			}
			if(c[j*2-1]=='R'){
				if(c[j*2]=='P') c[j]=c[j*2];
				else c[j]=c[j*2-1];
			}
			if(c[j*2-1]=='P'){
				if(c[j*2]=='S') c[j]=c[j*2];
				else c[j]=c[j*2-1];
			}
		}
	}
	cout<<c[1];
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    string s;
    bool winner[4][4] = {{true,false,true,false},{false,false,false,false},{false,false,true,true},{true,false,false,true}};
    string win;
    cin >> n >> k >> s;
    while(k--)
    {
        int len = s.size();
        if(len & 1)
        {
            len += len;
            s += s;
        }
        win.clear();
        for(int i = 0;i < len;i+=2)
        {
            win += winner[s[i] - 'P'][s[i+1]-'P']?s[i]:s[i+1];
        }
        s = win;
    }
    printf("%c\n",win[0]);
}
