#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;

int main(){
  int n,k;
  string s;
  cin >> n >> k >> s;
  rep(i,k){
    string t;
    if(n%2!=0){s+=s;n*=2;}
    for(int j=0;j<n;j+=2){
      if((s[j+1]=='P' and s[j]=='R') or (s[j+1]=='R' and s[j]=='S') or (s[j+1]=='S' and s[j]=='P'))t+=s[j+1];
      else t+=s[j];
    }
    //cout << t << "\n";
    s=t;n/=2;
  }
  cout << s[0];
}
#include <cstdio>
#define N 1048576
#define ll long long
#define mem(x, a) memset(x, a, sizeof x)
#define mpy(x, y) memcpy(x, y, sizeof y)
#define fo(x, a, b) for (int x = (a); x <= (b); x++)
#define fd(x, a, b) for (int x = (a); x >= (b); x--)
#define go(x) for (int p = tail[x], v; p; p = e[p].fr)
using namespace std;
int n, K;
char s[N];

inline int read() {
	int x = 0, f = 0; char c = getchar();
	while (c < '0' || c > '9') f = (c == '-') ? 1 : f, c = getchar();
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f ? -x : x;
}

bool win(char x, char y) {
	if (x == 'R' && y == 'S') return 1;
	if (x == 'P' && y == 'R') return 1;
	if (x == 'S' && y == 'P') return 1;
	return 0;
}

int main()
{
	scanf("%d%d\n%s", &n, &K, s + 1);
	
	int len = 1; while (len <= n) len <<= 1;
	
	fo(i, 1, K) {
		fo(i, 1, n) s[n + i] = s[i];
		fo(i, 1, n) 
			if (win(s[i * 2 - 1], s[i * 2])) s[i] = s[i * 2 - 1];
			else s[i] = s[i * 2];
	}
	printf("%c\n", s[1]);
	return 0;
}
