#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000007
//0=48,A=65,a=97

int main() {
    int n,k;cin >> n >> k;
    string s;cin >> s;
    for(int i = 0; i < k; i++) {
        s += s;
        string t;
        for(int j = 0; j < 2*n; j+=2) {
            if(s[j]=='R'){
                if(s[j+1]=='P') t += 'P';
                else t += 'R';
            }
            if(s[j]=='S'){
                if(s[j+1]=='R') t += 'R';
                else t += 'S';
            }
            if(s[j]=='P'){
                if(s[j+1]=='S') t += 'S';
                else t += 'P';
            }
        }
        s=t;
    }

    cout << s[0] << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;



template<typename T>
struct Doubling {
    using F = function<int(int,int)>;

    private:
    const int LOG, n;
    vector<vector<int>> index, DP;
    vector<vector<T>> sum;

    public:
    Doubling(const int n_, const int LOG_ = (int)log2(numeric_limits<long long>::max())) 
    : LOG(LOG_+1), n(n_), index(LOG, vector<int>(n)), DP(LOG, vector<int>(n)), sum(LOG, vector<T>(n, 0)) {
        for(int i = 0; i < n; i++)  index[0][i] = (i+1)%n;
        iota(DP[0].begin(), DP[0].end(), 0);
    }
    Doubling(const vector<int> move, const int LOG_ = (int)log2(numeric_limits<long long>::max()))
    : Doubling(move.size(), LOG_) {
        index[0] = move;
    }

    int operator() (const int i, const int j) { return DP[i][j]; }

    //costはその点の通過コスト
    //toは次にどこを含めるか
    void AddVertex(const int from, const int to, const T cost = 0){
        index[0][from] = to; sum[0][from] = cost;
    }
    
    //O(NlogN)
    void Build(){
        for(int k = 0; k+1 < LOG; k++){
            for(int i  = 0; i < n; i++){
                index[k+1][i] = index[k][index[k][i]];
                sum[k+1][i] = sum[k][i]+sum[k][index[k][i]];
            }
        }
    }
    void Build(F win){
        for(int k = 0; k+1 < LOG; k++){
            for(int i = 0; i < n; i++){
                index[k+1][i] = index[k][index[k][i]];
                DP[k+1][i] = win(DP[k][i], DP[k][index[k][i]]);
            }
        }
    }

    //O(logN)
    int IndexQuery(const int from, long long cnt){
        int ret = from;
        for(int k = 0; cnt > 0; k++, cnt >>= 1){
            if(cnt & 1){
                if(index[k][ret] == -1){
                    while(index[0][ret] >= 0) ret = index[0][ret];
                    return ret;
                } else ret = index[k][ret];
            }
        }
        return ret;
    }
    T SumQuery(const int from, long long cnt){
        int id = from; T ret = 0;
        for(int k = 0; cnt > 0; k++, cnt >>= 1){
            if(cnt & 1){
                ret += sum[k][id];
                id = index[k][id];
            }
        }
        return ret;
    }
};

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

    auto win = [&](int a, int b){
        if(s[a] < s[b] && !(s[a] == 'P' && s[b] == 'S')) return a;
        else if(s[a] < s[b]) return b;
        else if(s[a] > s[b] && !(s[a] == 'S' && s[b] == 'P')) return b;
        else if(s[a] > s[b]) return a;
        else return a;
    };

    Doubling<int> table(n, k);
    table.Build(win);

    cout << s[table(k, 0)] << endl;
}

void ABC167_D_Teleporter(){
    int n; long long k;
    cin >> n >> k;
    vector<int> a(n);

    for(int i = 0; i < n; i++) cin >> a[i], a[i]--;

    Doubling<int> table(a);
    table.Build();

    cout << table.IndexQuery(0, k)+1 << endl;
}

void ABC179_E_SequenceSum(){
    long long n,x,m;
    cin >> n >> x >> m;

    Doubling<long long> table(m);
    long long y = x;

    for(int i = 0; i < m; i++, y = y*y%m) table.AddVertex(y%m,y*y%m,y%m);
 
    table.Build();
 
    cout << table.SumQuery(x, n) << endl;
}

int main(){ 
    ARC109_C_LargeRPSTournament();
    return 0;
}