#include <bits/stdc++.h>

using namespace std;

#define int long long

int n, k; 

int dp [105][105]; // pos, 2^x players
int win [105]; 

int pows [105]; 
int winz (int a, int b){
    if (a==b) return a; 
    if (a>b) swap(a, b);
    if(a==0 && b==1) return 1; 
    if(a==0 && b==2) return 0; 
    if(a==1 && b==2) return 2; 
}
main(){
    ios_base::sync_with_stdio(0);
    
    pows[0]=1; 
    cin >> n >> k; 
    
    for (int i=1;i<105; i++) pows[i] = (2*pows[i-1])%n; 
    
    string s; cin >> s;//leng n
    
    for (int i=0; i<n; i++){
        if (s[i] == 'R') win[i]=0; 
        else if (s[i] == 'P') win[i]=1; 
        else win[i]=2; 
    }
    
    for (int i=0; i<n; i++) dp[i][0] = win[i]; 
    
    for (int i=1; i<=100; i++){
        for (int j=0; j<n; j++){
            int fi = dp[j][i-1]; 
            int si = (j + pows[i-1]) % n; 
            
            si = dp[si][i-1]; 
            
            dp[j][i] = winz(fi, si); 
        }
    }
    if (dp[0][k]==0)cout<<'R'; 
    else if (dp[0][k]==1) cout << 'P'; 
    else cout << 'S'; 
    
    return 0; 
}
#include <bits/stdc++.h>
//#include <atcoder/all>
#define int long long
#define rep(i,a) for (int i = 0; i < (a); i++ )
#define Rep(i,start,a) for (int i = start; i < (a); i++ )
#define ALL(vec) (vec).begin(), (vec).end()
#define Sort(vec) sort((vec).begin(), (vec).end()) // 小さい順
#define SORT(vec) sort((vec).begin(), (vec).end(), [](int a, int b){return a>b;}) // 大きい順
#define SORTll(vec) sort((vec).begin(), (vec).end(), [](long long a, long long b){return a>b;}) // 大きい順
#define debug(x) cerr << #x << " = " << (x) << endl
#define VI vector<int>
#define VLL vector<long long>
#define PII pair<int,int>
#define VPII vector<PII>
#define VB vector<bool>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define Graph vector<vector<int>>
#define PB emplace_back
#define USI unordered_set<int>
#define Maze vector<string>
#define Pqueue priority_queue
#define MP make_pair
#define WeightedGraph vector<vector<pair<int,ll>>> // parent, (to, cost)
#define mat vector<vector<long long>>

#define vecdebug(vec) {cerr << #vec << " = [" ; for(auto x : (vec)){cerr << (x) << ", ";} cerr << "]" << endl; }
#define vdebug(vec,i) cerr << #vec << "[" << (i) << "] = " << (vec)[(i)] << endl
#define vvdebug(vec,i,j) cerr << #vec << "[" << (i) << "][" << (j) << "] = " << (vec)[(i)][(j)] << endl
#define vvvdebug(vec,i,j,k) cerr << #vec << "[" << (i) << "][" << (j) << "][" << (k) <<"] = " << (vec)[(i)][(j)][(k)] << endl
#define pdebug(p) cerr << #p << " = [" << (p).first << ", " << (p).second << "]" << endl

typedef long long ll;
typedef long double ld;

const ll mod = 998244353;
const ll MOD = 1000000007;
const ll INFLL = (1LL << 62) -1;
const int INF = (1 << 30) -1;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const long double pi = 2*asin(1);
// cout << fixed << setprecision(16);

using namespace std;
//using namespace atcoder;

//using mint = modint1000000007;
//using mint = modint998244353;
//using mint = modint998244353;
//using mint = static_modint<7>;


inline void chmin(ll &x, ll y){
  if(x>y) x=y;
}

inline void chmax(ll &x, ll y){
  if(x<y) x=y;
}

inline int tonum(char X){
  return (int)(X-'a');
}

inline int ctoi(char x){
  return (int)(x-'0');
}

int Max(int x, int y){
  if(x>y) return x;
  return y;
}

int Min(int x, int y){
  if(x<y) return x;
  return y;
}

inline int tochar(int n){
  return (char)('a' + n);
}

inline int ABS(int n){
  if(n<0) return -n;
  return n;
}


int n,k;
string S;
VI twomod(200);

void init(){
  cin >> n >> k;
  cin >> S;
  twomod[0] = 1 % n;
  rep(j,190) twomod[j+1] = (2 * twomod[j]) % n;
}

char winhand(char h1, char h2){
  if(h1 == h2) return h1;
  if(h1 == 'R' && h2 == 'S') return 'R';
  if(h1 == 'R' && h2 == 'P') return 'P';
  if(h1 == 'P' && h2 == 'R') return 'P';
  if(h1 == 'P' && h2 == 'S') return 'S';
  if(h1 == 'S' && h2 == 'R') return 'R';
  if(h1 == 'S' && h2 == 'P') return 'S';
  return '?';
}

void solve(){
  init();
  vector<vector<char>> win(n, vector<char>(110));
  rep(i,n) win[i][0] = S[i];
  rep(j,105) rep(i,n){
    win[i][j+1] = winhand(win[i][j], win[ (twomod[j] + i) %n ][j]);
  }
  cout << win[0][k] << endl;
}

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  
  solve();
}