#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ldb double
template<typename T>void ckmn(T&a,T b){a=min(a,b);}
template<typename T>void ckmx(T&a,T b){a=max(a,b);}
void rd(int&x){scanf("%i",&x);}
void rd(ll&x){scanf("%lld",&x);}
void rd(char*x){scanf("%s",x);}
void rd(ldb&x){scanf("%lf",&x);}
void rd(string&x){scanf("%s",&x);}
template<typename T1,typename T2>void rd(pair<T1,T2>&x){rd(x.first);rd(x.second);}
template<typename T>void rd(vector<T>&x){for(T&i:x)rd(i);}
template<typename T,typename...A>void rd(T&x,A&...args){rd(x);rd(args...);}
template<typename T>void rd(){T x;rd(x);return x;}
int ri(){int x;rd(x);return x;}
template<typename T>vector<T> rv(int n){vector<T> x(n);rd(x);return x;}
template<typename T>void ra(T a[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]);}
template<typename T1,typename T2>void ra(T1 a[],T2 b[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]),rd(b[st+i]);}
template<typename T1,typename T2,typename T3>void ra(T1 a[],T2 b[],T3 c[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]),rd(b[st+i]),rd(c[st+i]);}
void re(vector<int> E[],int m,bool dir=0){for(int i=0,u,v;i<m;++i){rd(u,v);E[u].pb(v);if(!dir)E[v].pb(u);}}
template<typename T>void re(vector<pair<int,T>> E[],int m,bool dir=0){for(int i=0,u,v;i<m;++i){T w;rd(u,v,w);E[u].pb({v,w});if(!dir)E[v].pb({u,w});}}

const int N=105;
char s[N],t[N];
char win(char a,char b){
	if(a==b)return a;
	set<char> st={a,b};
	if(st.count('R')&&st.count('P'))return 'P';
	if(st.count('R')&&st.count('S'))return 'R';
	return 'S';
}
int main(){
	int n,k;
	rd(n,k);
	rd(s);
	for(int j=0,sz=1;j<k;j++,sz=sz*2%n){
		for(int i=0;i<n;i++)
			t[i]=win(s[i],s[(i+sz)%n]);
		for(int i=0;i<n;i++)s[i]=t[i];
	}
	printf("%c\n",s[0]);
	return 0;
}
#include <stdio.h>

constexpr unsigned char H[16] = {0, 1, 0, 3, 1, 1, 1, 1, 0, 1, 2, 2, 3, 1, 2, 3};

int main() {
  unsigned char n, k;
  scanf("%hhd %hhd", &n, &k);
  getchar_unlocked();
  unsigned char hh[200];
  for (unsigned char i = 0; i < n; i++) hh[i] = getchar_unlocked() - 80;
  for (unsigned char i = 0; i < k; i++) {
    for (unsigned char j = 0; j < n; j++) {
      if (i & 1)
        hh[j] = H[(hh[(j * 2) % n + n] * 4) + hh[((j * 2) + 1) % n + n]];
      else
        hh[j + n] = H[(hh[(j * 2) % n] * 4) + hh[((j * 2) + 1) % n]];
    }
  }
  if (k & 1)
    putchar_unlocked(hh[n] + 80);
  else
    putchar_unlocked(*hh + 80);
}
