//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#include <bits/stdc++.h>
#include<set>
#include <array>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound

#define si(x) int(x.size())
#define sum_all(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
const double pi = 2 * acos(0.0);
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, -1, 0, 1 };

const int dx8[] = { -1, 0, 1, 0,1,1,-1,-1 };
const int dy8[] = { 0, -1, 0, 1,1,-1,1,-1 };

ll min(ll a,ll b)
{
    if(a<b)return a;
    return b; 
}
ll max(ll a,ll b)
{
    if(a>b)return a;
    return b; 
}
ll ceil1(ll a,ll b)
{
    return(a+b-1)/b;
}
void read(vector<ll> & arr)
{
  for(ll i=0;i<si(arr);i++)
    cin >> arr[i];

}

void read_graph(vector<vector<ll>>& g, ll m)
{
  while(m--)
  {
    ll x,y; cin >> x>> y ;
    x--,y--; 
    g[x].pb(y);
    g[y].pb(x);
  }
}
string  x; 
 vector<ll> pw;
ll mod1;
char dp[200][200];
char calc(ll l,ll r,ll pos)
{


    if(l==r) return x[pos]; 
    if(dp[r][pos]!='&') return dp[r][pos];
  
    char w1= calc(l,r-1,pos);
    char w2= calc(l,r-1,(pos+pw[r-1])%mod1);
    char &ch=dp[r][pos];
    if((w1=='R' and w2=='P') or (w1=='S' and w2=='R') or (w1=='P' and w2=='S')) ch= w2;
    else 
    ch= w1; 
    return ch ;

    }   
void solve()
{
 
  ll n,k;
  cin >> n >> k ; 
  cin >> x ;
  mod1=si(x);
  for(ll i=0;i<200;i++) for(ll j=0;j<200;j++) dp[i][j]='&';
  pw=vector<ll>(200,1);
  for(ll i=1;i<200;i++)
    pw[i]=(pw[i-1]*2)%mod1;

  cout << calc(0,k,0) << endl; 

   
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    //int t; cin >> t; while (t--)
    solve();

}

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

vector<vector<char> > winner;

vector<int> powk2modn;

char solve(int n, int k, string& s) {
  if (winner[k][n] == '.') {
    if (k == 0) {
      winner[k][n] = s[n];
    }
    else {
      auto left = solve(n, k-1, s);
      auto right = solve((n + powk2modn[k-1]) % s.size(), k-1, s);
           if ((left == 'R' && right == 'S') || (left == 'S' && right == 'R')) winner[k][n] = 'R';
      else if ((left == 'P' && right == 'R') || (left == 'R' && right == 'P')) winner[k][n] = 'P';
      else if ((left == 'S' && right == 'P') || (left == 'P' && right == 'S')) winner[k][n] = 'S';
      else winner[k][n] = left;
    }
  }
  return winner[k][n];
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;

  winner = vector<vector<char> >(k+1, vector<char>(n+1, '.'));

  powk2modn = vector<int>(k+1);
  powk2modn[0] = 1 % n;
  for (int i = 1; i <= k; i++) powk2modn[i] = (powk2modn[i-1] * 2) % n;

  auto ans = solve(0, k, s);

  cout << ans << endl;

  return 0;
}
