//#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>

using namespace std;

#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int seed=233;
const int N=4e4+10;

char win[200][200];

int main()
{
    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';
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int n,m;
    string s,t;
    cin>>n>>m>>s;
    while(m--){
        t=s+s;
        for(int i=0;i<n;i++) s[i]=win[t[i*2]][t[i*2+1]];
    }
    cout<<s[0]<<endl;
    return 0;
}

#include "bits/stdc++.h"
using namespace std;

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define pb push_back
#define f first
#define s second
#define nl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MOD = 1e9+7;
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

char w[101];
int n, k;
string s;

char win(char a, char b){ // P R S
  if(b<a) swap(a, b);
  if(a=='R') return 'R';
  if(a=='P' && b=='R') return 'P';
  else if(a=='P' && b=='S') return 'S';
  return a; 
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // freopen("input.txt", "r", stdin); 
  // freopen("output.txt", "w", stdout);

  cin >> n >> k >> s;
  rep(i, 0, n-1) w[i]=s[i];
  int pt=1;
  rep(len, 1, k){
    vi v(n);
    rep(i, 0, n-1){
      v[i]=win(w[i], w[(i+pt+n)%n]);
    }
    rep(i, 0, n-1) w[i]=v[i];
    pt=(pt*2)%n;
  }
  cout << w[0];
}