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

#define rep(i,n) for(int i = 0; i < (n); ++i)
using ll = long long;

char win(char a, char b) {
	if (a == b)return a;
	if ((a == 'R'&&b == 'S') || (a == 'S'&&b == 'P') || (a == 'P'&&b == 'R')) {
		return a;
	}
	return b;
}

signed main(void) {
	int n, k;
	string s;
	cin >> n >> k >> s;
	rep(i, k) {
		if (s.size() % 2 == 1) {
			s += s;
		}
		string buf = "";
		rep(j, s.size() / 2) {
			buf += win(s[2 * j], s[2 * j + 1]);
		}
		s = buf;
	}
	cout << s[0] << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define M 1000000007
#define INF ((1LL<<62LL) - 1)

int n,k;

char win(char x, char y){
    string gg = "RSP";

    if(x == y) return x;

    for(int i=0;i<3;i++){
        if(gg[i] == x && gg[(i+1)%3] == y) return x;
        if(gg[i] == y && gg[(i+1)%3] == x) return y;
    }
    return x;
}

int po(int a, int b){
    if(b==0) return 1;
    if(b == 1) return a;

    int temp = po(a, b/2);
    temp *= temp;
    temp%=n;

    if(b&1) temp*=a;
    temp%=n;

    return temp;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

    char ans[n+1][k+1];

    for(int i=0;i<n;i++){
        ans[i][0] = s[i];
    }

    for(int j = 1;j<=k;j++){
        //cout << j << "\n";
        for(int left = 0;left<n;left++){
            int right = left + po(2, j-1);
            right%=n;

            ans[left][j] = win(ans[left][j-1], ans[right][j-1]);

            //cout << left << " " << right << "   " <<  ans[left][j] << " won in " << ans[left][j-1] << " " << ans[right][j-1] << "\n";
        }
        //cout << "\n";
    }

    cout << ans[0][k] << "\n";


}
