#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vp> vvp;

// input
int n, k;
string s;


void input() {
    cin >> n >> k;
    cin >> s;
}


int main() {
    input();
    map<char, map<char, char>> m;
    m['R']['R'] = m['R']['S'] = m['S']['R'] = 'R';
    m['P']['P'] = m['P']['R'] = m['R']['P'] = 'P';
    m['S']['S'] = m['P']['S'] = m['S']['P'] = 'S';
    rep(i, k) {
        s += s;
        int sn = s.size();
        string t = "";
        for (int j = 0; j < sn; j += 2) t += m[s[j]][s[j + 1]];
        swap(s, t);
    }
    char ans = s[0];
    cout << ans << endl;
}

#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 105

char buf[SIZE],work[2*SIZE];

char calc(char a,char b){

	switch(a){
	case 'R':
		switch(b){
		case 'R':return 'R';
		case 'P':return 'P';
		case 'S':return 'R';
		}
		break;
	case 'P':
		switch(b){
		case 'R':return 'P';
		case 'P':return 'P';
		case 'S':return 'S';
		}
		break;
	case 'S':
		switch(b){
		case 'R':return 'R';
		case 'P':return 'S';
		case 'S':return 'S';
		}
		break;
	}
	return '@';
}


int main(){

	int N,K;

	scanf("%d %d",&N,&K);
	scanf("%s",buf);

	for(int a = 0; a < K; a++){

		int index = 0;
		for(int loop = 0; loop < 2; loop++){

			for(int i = 0; i < N; i++){

				work[index] = buf[i];
				index++;
			}
		}

		index = 0;
		for(int i = 0; i < 2*N; i += 2){

			buf[index++] = calc(work[i],work[i+1]);
		}
	}

	printf("%c\n",buf[0]);

	return 0;
}
