#include <bits/stdc++.h>

#define ll long long
#define str string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

#define vc vector<char>
#define vvc vector<vc>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvvll vector<vvll>
#define vs vector<str>
#define vvs vector<vs>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vpll vector<pll>
#define vvpll vector<vpll>
#define vb vector<bool>
#define vvb vector<vb>
#define rep(i, a, b) for (int i = (a); i < int(b); i++)
#define repi(i, a, b) for (int i = (a); i <= int(b); i++)


using namespace std;
ll INF = LONG_LONG_MAX;
ll mod = 1000000000 + 7;

template <typename T, typename L>
void read(vector<T> & _data, L & _size, bool _shift) {
    _data.resize(_size + (ll)_shift);
    for (ll i = (ll)_shift; i < _size + (ll)_shift; i++)
        cin >> _data[i];
}

template <typename T, typename L>
void read(vector<vector<T>> & _data, L & _rows, L & _cols, bool _shiftRows, bool _shiftCols) {
    _data.resize(_rows + (ll)_shiftRows);
    for (ll i = 0; i < _rows + (ll)_shiftRows; i++)
        _data[i].resize(_cols + (ll)_shiftCols);
    for (ll i = (ll)_shiftRows; i < _rows + (ll)_shiftRows; i++)
        for (ll j = (ll)_shiftCols; j < _cols + (ll)_shiftCols; j++)
            cin >> _data[i][j];
}

template <typename T>
void write(vector<T> & _data, bool _shift) {
    for (ll i = (ll)_shift; i < _data.size(); i++)
        cout << _data[i] << " ";
    cout << endl;
}


//TODO: SOLUTION

char playGame(str & s, int l, int r) {
    if (l == r)
        return s[l];
    char w1 = playGame(s, l, (l + r) / 2);
    char w2 = playGame(s, (l + r) / 2 + 1, r);

    if (w1 == 'R') {
        if (w2 == 'P')
            return w2;
        else
            return w1;
    }
    if (w1 == 'P') {
        if (w2 == 'S')
            return w2;
        else
            return w1;
    }
    if (w1 == 'S') {
        if (w2 == 'R')
            return w2;
        else
            return w1;
    }
    return w1;
}

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

    if (k <= 15) {
        str w;
        while (w.size() < pow(2, k))
            w += s;
        cout << playGame(w, 0, pow(2, k) - 1);
        return;
    }

    int played = 0;
    while (played < k) {
        str a;
        s += s;
        for (int i = 0; i < n; i++)
            a.push_back(playGame(s, 2*i, 2*i + 1));
        s = a;
        played++;
    }

    cout << s[0] << endl;
}


int main() {

    // TODO: Set value of this variable manually
    bool _multipleTestCases = false;

    if (_multipleTestCases) {
        ll t; cin >> t;
        while (t--)
            solve();
    }
    else {
        solve();
    }

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

char win[256][256];

int main()
{
    // editorial
    // 区間長2nの隣同士の対戦結果から
    // 区間長nの列を生成

    win['R']['R'] = win['R']['S'] = win['S']['R'] = 'R';
    win['P']['P'] = win['P']['R'] = win['R']['P'] = 'P';
    win['S']['S'] = win['S']['P'] = win['P']['S'] = 'S';

    int n, k;
    string s;

    cin >> n >> k >> s;

    rep(x, k) {
        string t = s + s;
        rep(i, n) {
            int a = t[i * 2], b = t[i * 2 + 1];
            s[i] = win[a][b];
        }
    }

    cout << s[0] << "\n"s;

    return 0;
}
