Score : $500$ points
To decide which is the strongest among Rock, Paper, and Scissors, we will hold an RPS tournament. There are $2^k$ players in this tournament, numbered $0$ through $2^k-1$. Each player has his/her favorite hand, which he/she will use in every match.
A string $s$ of length $n$ consisting of R, P, and S represents the players' favorite hands.
Specifically, the favorite hand of Player $i$ is represented by the $((i\text{ mod } n) + 1)$-th character of $s$; R, P, and S stand for Rock, Paper, and Scissors, respectively.
For $l$ and $r$ such that $r-l$ is a power of $2$, the winner of the tournament held among Players $l$ through $r-1$ will be determined as follows:
Find the favorite hand of the winner of the tournament held among Players $0$ through $2^k-1$.
R beats S;P beats R;S beats P.R, P, and S.Input is given from Standard Input in the following format:
$n$ $k$ $s$
Print the favorite hand of the winner of the tournament held among Players $0$ through $2^k-1$, as R, P, or S.
3 2 RPS
P
P.R.P.Thus, the answer is P.
P ┌─┴─┐ P R ┌┴┐ ┌┴┐ R P S R
11 1 RPSSPRSPPRS
P
1 100 S
S