//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//~ while (clock()<=69*CLOCKS_PER_SEC)

#define ll long long
#define ld long double
#define pi pair<int,int>
#define pd pair<ld,ld>
#define ft first
#define sd second
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define FOR(i,a,b) for(int i=(a); i<=(b);i++)
#define F(i,a,b) FOR(i,(a),(b)-1)
#define REV(i,a,b) for(int i=(a); i>=(b);i--)
#define VI vector<int>
#define VPI vector<pi>
#define VPD vector<pd>
#define PI 3.14159265
#define all(x) (x).begin(), (x).end()
#define sz(a) (int)((a).size())
#define int long long

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long K = 1000;
const long long KK = K*K;
const long long MIL = KK*K;
const long long INF = MIL*MIL;
const long long MOD = 1e9 + 7;
const long long N = 1e3 + 10, M=10;


bool wins(char a, char b) {
    if (b == 'R' && a == 'S')
        return false;
    if (b == 'S' && a == 'P')
        return false;
    if (b == 'P' && a == 'R')
        return false;

    return true;
}

void solve() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    F(i, 0, k) {
        if (sz(s) % 2)
            s += s;
        string s1;
        for (int j = 0; j < sz(s); j += 2) {
            if (wins(s[j], s[j + 1])) {
                s1 += s[j];
            } else {
                s1 += s[j + 1];
            }
        }
        s = s1;
    }
    cout << s[0] << "\n";

}

int32_t main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    cout.tie(0);
    cerr.tie(0);
    cout << setprecision(9) << fixed;
    cerr << setprecision(6) << fixed;
    int test = 1, f;
//    cin >> test;
    F(_test, 0, test) {
        //cout<<"Case #"<<_test + 1<<": ";
        solve();
//		if(_test == 1)
//            return 0;
    }
}
/*

2 1 3
1 1 <= 3
2 1 <= 5
1 1 >= 4
2 2 4
1 1 <= 3
2 1 <= 4
1 2 >= 5
2 2 >= 7
0 0 0
 */
#pragma GCC optimize ("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
#include <x86intrin.h>
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//gp_hash_table<key, int, chash> table;

#define PI 3.141592653589793L
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); srand(time(NULL));
// Use for file I/O;
#define FIN string _fname = "input"; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);

#define FIN2 freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define gsize(x) (int)((x).size())

using namespace std;
using namespace __gnu_pbds;

const char nl = '\n';

typedef long long ll;
typedef long double ld;
// typedef unsigned int uint;
typedef unsigned long long ull;

const ll inf = 1e9 + 10;
const ll inf2 = 1e18 + 99LL;
const ld inf3 = 1e14;
const __int128 mod = 1e9 + 7;
const ld eps = 5e-10;

const int logn = 10, maxn = 105, maxm = 8000001, K = 3;

ll n, k;
map<int, char> ttm[maxn];
int tk[maxn];
string s;

char solve(int si, int ck) {
	if (ck == 0) {
		// cout << si << ' ' << s[si] << endl;
		return s[si];
	} else {
		if (!ttm[ck].count(si)) {
			char r1 = solve(si, ck - 1), r2 = solve((si + tk[ck - 1]) % n, ck - 1);
			if (r1 == r2) {
				ttm[ck][si] = r1;
			} else {
				if (r1 == 'R') {
					if (r2 == 'S') {
						ttm[ck][si] = r1;
					} else {
						ttm[ck][si] = r2;
					}
				} else if (r1 == 'S') {
					if (r2 == 'P') ttm[ck][si] = r1;
					else ttm[ck][si] = r2;
				} else {
					if (r2 == 'S') ttm[ck][si] = r2;
					else ttm[ck][si] = r1;
				}
			}
			// cout << "HI" << endl;
		}
		// cout << si << ' ' << ck << ' ' << ttm[si][ck] << endl;
		return ttm[ck][si];
	}
}

int main() {
	FAST;

	cin >> n >> k;
	cin >> s;
	tk[0] = 1;
	for (int i = 1; i <= k; i++) {
		tk[i] = (tk[i - 1] * 2) % n;
	}
	cout << solve(0, k);
}