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

#define DEBUG
#ifdef DEBUG
inline void debug_print() { cerr << endl; }
template <typename T1, typename... T2> void debug_print(const T1 a, const T2 &... b) { cerr << a << ' '; debug_print(b...); }
#define debug(...) cerr << __LINE__ << ": [" << #__VA_ARGS__ << "] = " , debug_print(__VA_ARGS__);
#else
#define debug(...) true
#endif

inline void print() { cout << '\n'; }
template <typename T1, typename... T2> void print(const T1 a, const T2 &... b) { cout << a << ' '; print(b...); }

template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto e : v) os << e << ' '; return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) { for (auto e : v) os << e << ' ';  return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp) { for (auto e : mp) os << e << ' '; return os; }

template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } else return false; }
template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } else return false; }

//-------------------------- Libraries --------------------------//

//---------------------------- Solve ----------------------------//

string simulate(string s, int k) {

    s += s;
    string res;
    for (int i = 0; i < s.size(); i+=2) {
        if (s[i] == 'R') {
            if (s[i+1] == 'R') res += 'R';
            if (s[i+1] == 'S') res += 'R';
            if (s[i+1] == 'P') res += 'P';
        }
        if (s[i] == 'S') {
            if (s[i+1] == 'R') res += 'R';
            if (s[i+1] == 'S') res += 'S';
            if (s[i+1] == 'P') res += 'S';
        }
        if (s[i] == 'P') {
            if (s[i+1] == 'R') res += 'P';
            if (s[i+1] == 'S') res += 'S';
            if (s[i+1] == 'P') res += 'P';
        }
    }

    if (k < 7) {
        int tmp = 1;
        for (int i = 0; i < k; i++) {
            tmp *= 2;
        }
        if (tmp < res.size()) {
            string t;
            for (int i = 0; i < tmp; i++) {
                t += res[i];
            }
            res = t;
        }
    }

    return res;
} 

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

    int K = k;
    for (int i = 0; i < k; i++) {
        s = simulate(s, K-1);
        K--;
    }

    cout << s << '\n';
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}
// C - Large RPS Tournament
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

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

int main(){
	int N, K; string S; cin>>N>>K>>S;
	while(K--){
		string t = S + S;
		rep(i, N) S[i] = not_loser(t[i*2], t[i*2+1]);
	}
	cout<< S[0] <<endl;
}
