#include<iostream>
#include<string>
#include<vector>
#include<map>

using namespace std;

char winner(char a, char b){
    if(a == b) return a;
    int x;
    if(a == 'R') x = 1;
    else if (a == 'S') x = 2;
    else x = 4;
    int y;
    if(b == 'R') y = 1;
    else if (b == 'S') y = 2;
    else y = 4;
    char res;
    if(x + y == 3) res = 'R';
    if(x + y == 5) res = 'P';
    if(x + y == 6) res = 'S';
    return res;
}

int main(){
    int n, k;
    string s;
    cin >> n >> k >> s;
    for(int i = 0; i < k; i++){
        string t = s + s;
        for(int j = 0; j < n; j++){
            s[j] = winner(t[2 * j], t[2 * j + 1]);
        }
    }
    cout << s[0];
}
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int n,k;
  string s;
  cin>>n>>k>>s;
  if(n%2 == 1){
    s = s+s;
    n = n+n;
  }
  string p = "";
  string ans = "";
  while(1){
    if(k<1){
      ans = p;
      break;
    }
    p = "";
    int nagasa = (int)s.size();
    for(int i = 0;i<nagasa;i+=2){
      if(s.at(i) == 'S' && s.at(i+1) == 'S'){
        p+='S';
      }
      if(s.at(i) == 'S' && s.at(i+1) == 'R'){
        p+='R';
      }
      if(s.at(i) == 'S' && s.at(i+1) == 'P'){
        p+='S';
      }
      if(s.at(i) == 'R' && s.at(i+1) == 'S'){
        p+='R';
      }
      if(s.at(i) == 'R' && s.at(i+1) == 'R'){
        p+='R';
      }
      if(s.at(i) == 'R' && s.at(i+1) == 'P'){
        p+='P';
      }
      if(s.at(i) == 'P' && s.at(i+1) == 'S'){
        p+='S';
      }
      if(s.at(i) == 'P' && s.at(i+1) == 'R'){
        p+='P';
      }
      if(s.at(i) == 'P' && s.at(i+1) == 'P'){
        p+='P';
      }
    }
    if(p.size()%2 == 1){
      p = p+p;
    }
    s = p;
    k--;
  }
  cout << ans.at(0) << endl;
  return 0;
}