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

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    rep(i, k) {
        int len = s.size();
        int original = len;
        if (len % 2) {
            len *= 2;
        }
        string ns = "";
        rep(j, len) {
            int t = j % original;
            int nt = (j + 1) % original;
            if (s[t] == 'P') {
                if (s[nt] == 'S') {
                    ns += 'S';
                } else {
                    ns += 'P';
                }
            }
            if (s[t] == 'R') {
                if (s[nt] == 'P') {
                    ns += 'P';
                } else {
                    ns += 'R';
                }
            }
            if (s[t] == 'S') {
                if (s[nt] == 'R') {
                    ns += 'R';
                } else {
                    ns += 'S';
                }
            }
            ++j;
        }
        s = ns;
    }

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

inline int read(){
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    return s*w;
}

inline bool read(int& a){
    int s=0,w=1;
    char ch=getchar();
    if(ch==EOF){
		return false;
	}
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    a=s*w;
    return true;
}

inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

inline void writeln(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
    puts("");
}

signed main(){
   	int a=read(),b=read();
   	int x,y;
   	x=(a+b)/2;
   	y=a-x;
   	printf("%lld %lld\n",x,y);
   	return 0;
}