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



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int n, k;
	string s;
	cin >> n >> k >> s;
	vector<vector<int>> dp(k + 1, vector<int>(n));
	vector<vector<int>> op{
		{0, 1, 0}
		, {1, 1, 2}
		, {0, 2, 2}
	};
	vector<int> rem(k + 1, 1);
	for(auto l = 1; l <= k; ++ l){
		rem[l] = (rem[l - 1] * 2) % n;
	}
	for(auto i = 0; i < n; ++ i){
		if(s[i] == 'P'){
			dp[0][i] = 1;
		}
		else if(s[i] == 'S'){
			dp[0][i] = 2;
		}
	}
	for(auto l = 1; l <= k; ++ l){
		for(auto i = 0; i < n; ++ i){
			dp[l][i] = op[dp[l - 1][i]][dp[l - 1][(i + rem[l - 1]) % n]];
		}
	}
	if(dp[k][0] == 0){
		cout << "R\n";
	}
	else if(dp[k][0] == 1){
		cout << "P\n";
	}
	else{
		cout << "S\n";
	}
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#include <map>
#include <vector>
#include <cstdio>
#include <climits>
#define white 0
#define gray 1
#define black 2
#define LIMIT (1<<30)
#define MOD 1000000007
//#define MOD 998244353
#define ll long long
#define str string
using namespace std;

//const ll INF = LLONG_MAX;
//cout << fixed << setprecision(10) << ans << endl;
//pair<ll, ll> vec[4] = {make_pair(1, 0), make_pair(0, 1), make_pair(-1, 0), make_pair(0, -1)};

char match(char x, char y){
    if(x == y) return x;
    if(x == 'R' && y == 'S') return 'R';
    if(x == 'R' && y == 'P') return 'P';
    if(y == 'R' && x == 'S') return 'R';
    if(y == 'R' && x == 'P') return 'P';
    return 'S';
}

int main(){
    int n, k;
    str s;
    cin >> n >> k >> s;
    
    for(int i=0; i<k; i++){
        if(s.length() % 2 != 0) s += s;
        str memo = "";
        for(ll i=0; i<s.length(); i+=2){
            memo += match(s[i], s[i + 1]);
        }
        s = memo;
    }
    
    cout << s[0] << endl;
}
