#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

const int INF = (1<<30)-1;
const ll LINF = 1e18;

#define rep(i, n) for (int i = 0; i < n; i++)

template<class T> 
bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}

template<class T> 
bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;}

char janken[] = {'R', 'S', 'P'};
int memo[101][101];
int v[100];
int n, k;

int mod_pow(int a, int x) {
    if (x == 0)
        return 1;
    else if (x % 2)
        return a * mod_pow(a, x-1) % n;
    else {
        int tmp = mod_pow(a, x/2);
        return tmp * tmp % n;
    } 
}

int func(int l, int i)  {
    //cout << l << " " << i << "にきた" << endl;
    if (memo[l][i] != -1)
        return memo[l][i];
    if (l == 0) {
        //cout << v[i%n] << "の価値" << endl;
        return memo[l][i] = v[i % n];
    }
    
    //cout << l-1 << " " << i << " と" << l-1 << " " << (i+mod_pow(2, l-1))%n << "にいく" << endl;
    int a = func(l-1, i), b = func(l-1, (i+mod_pow(2, l-1))%n), ans;
    if (a == b)
        ans = a;
    else if ((a+1) % 3 == b)
        ans = a;
    else 
        ans = b;
    return memo[l][i] = ans;
    //cout << ans << "の価値" << endl;
}

int main() {
    cin >> n >> k;
    string s;   cin >> s;
    rep(i, 101)rep(j, 101)  memo[i][j] = -1;
    rep(i, n) {
        rep(j, 3) {
            if (janken[j] == s[i])
                v[i] = j;
        }
    }
    
    int ans = func(k, 0);
    rep(j, 3) {
        if (janken[j] == janken[ans])
            cout << janken[j] << endl;
    }
    return 0;
}

//小数点精度
//cout << fixed << std::setprecision(15) << y << endl;
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
//#include <atcoder/all>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int n,k; string s;

char f(char a, char b){
  if(a=='R'){
    if(b==('R')) return 'R';
    if(b==('P')) return 'P';
    if(b==('S')) return 'R';
  }
  if(a=='P'){
    if(b==('R')) return 'P';
    if(b==('P')) return 'P';
    if(b==('S')) return 'S';
  }
  if(a=='S'){
    if(b==('R')) return 'R';
    if(b==('P')) return 'S';
    if(b==('S')) return 'S';
  }
}

int main(){
  cin >> n >> k;
  cin >> s;
  rep(i,k){
    string news;
    if(sz(s)%2) s+=s;
    rep(j,sz(s)/2){
      news += f(s[2*j], s[2*j+1]);
    }
    s = news;
  }
  cout << s[0] << endl;
  return 0;
}
