#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define MOD 1000000007
#define INF 1000000000
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t1=1;
    //cin>>t;
    while(t1--){
        int n,k;
        cin>>n>>k;
        string s;
        cin>>s;
        for(int j=0;j<k;j++){
            string t=s+s;
            s="";
            for(int i=0;i<2*n;i+=2){
                if(t[i]==t[i+1])
                    s+=t[i];
                else if((t[i]=='R'&&t[i+1]=='S')||(t[i]=='S'&&t[i+1]=='R'))
                    s+='R';
                else if((t[i]=='S'&&t[i+1]=='P')||(t[i]=='P'&&t[i+1]=='S'))
                    s+='S';
                else if((t[i]=='R'&&t[i+1]=='P')||(t[i]=='P'&&t[i+1]=='R'))
                    s+='P';
            }
        }
        cout<<s[0]<<"\n";
    }
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

ll n,k;
vector<string> s(101);
char a;

int main(){
  cin>>n>>k>>s[0];
  rep(i,k){
    rep(j,n)s[i].push_back(s[i][j]);
    rep(j,n){
      if(s[i][2*j]==s[i][2*j+1])a=s[i][2*j];
      else if((s[i][2*j]=='R' && s[i][2*j+1]=='S') || (s[i][2*j]=='S' && s[i][2*j+1]=='R'))a='R';
      else if((s[i][2*j]=='P' && s[i][2*j+1]=='R') || (s[i][2*j]=='R' && s[i][2*j+1]=='P'))a='P';
      else a='S';
      s[i+1].push_back(a);
    }
  }
  cout<<s[k][0]<<endl;
}
