// C - Large RPS Tournament
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

map<char,char> win{{'R','P'}, {'P','S'}, {'S','R'}}; // [lose]=win

int main(){
	int N, K; string S; cin>>N>>K>>S;
	while(K--){
		string t = S + S;
		rep(i, N){
			char a = t[i*2], b = t[i*2+1];
			S[i] = win[a]==b? b:a;
		}
	}
	cout<< S[0] <<endl;
}

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


int main(){
	long long a,b,c,d;cin>>a>>b>>c>>d;
	cout<<min(a,min(b,min(c,d)))<<"\n";
	return 0;
}	