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

// true : l winner, false : r winner
bool winnerRPS(char l, char r)
{
  return
    l == r ||
    l == 'R' && r == 'S' ||
    l == 'P' && r == 'R' ||
    l == 'S' && r == 'P';
}

int main()
{
  int n, k;
  std::cin >> n >> k;
  std::string s;
  std::cin >> s;

  for (int i = 0; i < k; i++)
  {
    std::string stmp = s;
    if (s.length() % 2 == 1) { stmp += s; }

    s.clear();
    for (int i = 0; i < stmp.size(); i+=2)
    {
      char winnerhand =
        winnerRPS(stmp[i], stmp[i + 1]) ? stmp[i] : stmp[i + 1];
      s.push_back(winnerhand);
    }
  }

  std::cout << s[0] << std::endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    string now,tmp;
    cin>>now;
    while(k--)
    {
        now=now+now;tmp.clear();
        for(int i=0;i<now.size();i+=2)
        {
            if(now[i]=='R'&&now[i+1]=='P')tmp.push_back('P');
            else if(now[i]=='P'&&now[i+1]=='R')tmp.push_back('P');
            else if(now[i]=='R'&&now[i+1]=='S')tmp.push_back('R');
            else if(now[i]=='S'&&now[i+1]=='R')tmp.push_back('R');
            else if(now[i]=='S'&&now[i+1]=='P')tmp.push_back('S');
            else if(now[i]=='P'&&now[i+1]=='S')tmp.push_back('S');
            else tmp.push_back(now[i]);
        }
        swap(tmp,now);
    }
    cout<<now[0];
    return 0;
}