#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define all(v) v.begin(),v.end()
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast") 
#pragma gcc optimize("unroll-loops")
using namespace std;
const int INF = 1e9;
const int TMX = 1 << 18;
const long long llINF = 5e18;
const long long mod = 1e9+7;
const long long hmod1 = 1e9+409;
const long long hmod2 = 1e9+433;
const long long base = 257;
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pi;
typedef pair <ll,ll> pl;
typedef vector <int> vec;
typedef vector <pi> vecpi;
typedef long long ll;
int a[205];
int n,k;

int f(int x,int y) {
	if(x == y) return x;
	if(x > y) swap(x,y);
	if(x == 0&&y == 2) return 2;
	return x;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k;
	for(int i = 1;i <= n;i++) {
		char x; cin >> x;
		if(x == 'R') a[i] = 0;
		if(x == 'S') a[i] = 1;
		if(x == 'P') a[i] = 2;
		a[n+i] = a[i];
	}
	for(int i = 1;i <= k;i++) {
		for(int j = 1;j <= n;j++) a[j] = f(a[j*2-1],a[j*2]);
		for(int j = 1;j <= n;j++) a[n+j] = a[j];
	}
	cout << (!a[1] ? 'R' : (a[1] & 1 ? 'S' : 'P'));
}

#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    auto convert = [](char a) { return a == 'R' ? 0 : a == 'P' ? 1 : 2; };
    auto match = [&](char a, char b) {
        int x = convert(a), y = convert(b);
        int z = (y - x + 3) % 3;
        return z == 1 ? b : a;
    };

    rep(i, k) {
        string t(s.size(), '_');
        rep(j, n) {
            t[j] = match(s[(2 * j) % n], s[(2 * j + 1) % n]);
        }
        s = t;
    }

    write(s[0]);
}
