#include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 300005
#define MOD 1000000007
#define INF 1000000000000000000
#define EPS 0.0000000001
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
char s[103];
char bst[24000000];
int n,k;
void make_it(int index,int l,int r)
{
    if(l==r)
    {
        bst[index]=(s[l%n]);
        return;
    }
    int m=(l+r)/2;
    make_it(index*2,l,m);
    make_it(index*2+1,m+1,r);
    if(bst[index*2]==bst[index*2+1]) bst[index]=bst[index*2];
    else if(bst[index*2]!='R'&&bst[index*2+1]!='R') bst[index]='S';
    else if(bst[index*2]!='S'&&bst[index*2+1]!='S') bst[index]='P';
    else bst[index]='R';
}
int main()
{
    int i,j;
    scanf("%d %d ",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%c",&s[i]);
    }
    k=min(k,22);
    int m=1<<k;
    make_it(1,0,m-1);
    printf("%c",bst[1]);
    return 0;
}

//Author: RingweEH
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define ll long long
#define db double
using namespace std;
int min( int a,int b ) { return a<b ? a : b; }
int max( int a,int b ) { return a>b ? a : b; }
int read()
{
    int x=0,w=1; char ch=getchar();
    while ( ch>'9' || ch<'0' ) { if ( ch=='-' ) w=-1; ch=getchar(); }
    while ( ch<='9' && ch>='0' ) x=x*10+ch-'0',ch=getchar();
    return x*w;
}

ll n,k;
char win[230][230];
string str,dbstr;

int main()
{
	n=read(); k=read(); cin>>str;
	win['R']['R']=win['R']['S']=win['S']['R']='R';
	win['S']['S']=win['S']['P']=win['P']['S']='S';
	win['P']['P']=win['P']['R']=win['R']['P']='P';

	while ( k-- )
	{
		dbstr=str+str;
		for ( int i=0; i<n; i++ )
			str[i]=win[dbstr[i*2]][dbstr[i*2+1]];
	}

	cout<<str[0];

	return 0;
}