#include <bits/stdc++.h>

using namespace std;

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

	if (n % 2 != 0) {
		n *= 2;
		s += s;
	}
	function<char(int l, int r)> calc_winner = [&] (int left, int right) {
		if (left == right || (left == 'R' && right == 'S') ||
			(left == 'P' && right == 'R') || (left == 'S' && right == 'P')) {
			return left;
		} else {
			return right;
		}
	};

	for (int round = 0; round < k; ++round) {	
		string next_round = "";
		for (int i = 0; i < n-1; i += 2) {
			next_round += calc_winner(s[i], s[i+1]);
		}
		s = next_round;
		if (n % 2 == 0) {
			s += s;
		}
	}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	return 0;
}

#include <cstdio>
using namespace std;

const int max_n = 100, tab[3][3] = {
	0, 1, 0,
	1, 1, 2,
	0, 2, 2
};

int dp[max_n][max_n+1], pmn[max_n+1];
char s[max_n];

int main()
{
	int n, k;

	scanf("%d%d%s", &n, &k, s);

	if (n == 1)
	{
		puts(s);
		return 0;
	}

	pmn[0] = 1;
	for (int i = 1; i <= k; i++)
		pmn[i] = (pmn[i-1] * 2) % n;
	
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'R') dp[i][0] = 0;
		if (s[i] == 'P') dp[i][0] = 1;
		if (s[i] == 'S') dp[i][0] = 2;
	}

	for (int j = 1; j <= k; j++)
		for (int i = 0; i < n; i++)
			dp[i][j] = tab[dp[i][j-1]][dp[(i+pmn[j-1])%n][j-1]];
	
	switch (dp[0][k])
	{
		case 0: puts("R"); break;
		case 1: puts("P"); break;
		case 2: puts("S"); break;
	}

	return 0;
}