#include <bits/stdc++.h>
using namespace std;

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

    while(k > 0){
        k -= 1;
        if(n % 2 == 1){
            s += s;
            n *= 2;
        }
        //cout << s << endl;

        string ns = "";
        for(int i=0; 2*i+1<n; i++){
            if((s[2*i] == 'R' && s[2*i+1] == 'P')
            || (s[2*i] == 'P' && s[2*i+1] == 'S')
            || (s[2*i] == 'S' && s[2*i+1] == 'R')) swap(s[2*i], s[2*i+1]); 
            ns += s[2*i];
        }
        s = ns;
        n = ns.length();
        if(n == 1) break;
    }
    cout << s[0] << endl;
    return 0;
}
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 123;
const int mod = 998244353;


#define int long long
string s;
int n, k;
char w[200][200];
int d[200][200];

char lmao(char a, char b) {
	if(a == b) return a;

	else if(a == 'R') {
		if(b == 'P') return b;
		else return a;
	}else if(a == 'P') {
		if(b == 'S') return b;
		else return a;
	}else {
		if(b == 'R') return b;
		else return a;
	}
}
 main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> k;
	cin >> s;

	for(int i = 0; i < n; i++)
		w[i][0] = s[(i)%n];
	for(int i = 0; i < n; i++) {
		d[i][0] = i;
	}
	for(int j = 1; j <= 150; j++) {
		
	for(int i = 0; i< n; i++){
			int nx = d[i][j - 1];
			 
			nx++;
			nx %= n;
			d[i][j] = d[nx][j - 1];
		}
	}

	for(int j = 1; j <= k; j++) {
		
	for(int i = 0; i < n; i++) {
			int nx = d[i][j - 1];
			nx++;
			nx %= n;

			w[i][j] = lmao(w[i][j - 1], w[nx][j - 1]);
		}
	}
	cout << w[0][k];
}























