Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.

While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can play any number of rounds. In the first round, he chooses "Rock", "Scissors" or "Paper" based on the value of $s_{pos}$:   if $s_{pos}$ is equal to R the bot chooses "Rock";  if $s_{pos}$ is equal to S the bot chooses "Scissors";  if $s_{pos}$ is equal to P the bot chooses "Paper"; 

In the second round, the bot's choice is based on the value of $s_{pos + 1}$. In the third round — on $s_{pos + 2}$ and so on. After $s_n$ the bot returns to $s_1$ and continues his game.

You plan to play $n$ rounds and you've already figured out the string $s$ but still don't know what is the starting index $pos$. But since the bot's tactic is so boring, you've decided to find $n$ choices to each round to maximize the average number of wins.

In other words, let's suggest your choices are $c_1 c_2 \dots c_n$ and if the bot starts from index $pos$ then you'll win in $win(pos)$ rounds. Find $c_1 c_2 \dots c_n$ such that $\frac{win(1) + win(2) + \dots + win(n)}{n}$ is maximum possible.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases.

Next $t$ lines contain test cases — one per line. The first and only line of each test case contains string $s = s_1 s_2 \dots s_{n}$ ($1 \le n \le 2 \cdot 10^5$; $s_i \in \{\text{R}, \text{S}, \text{P}\}$) — the string of the bot.

It's guaranteed that the total length of all strings in one test doesn't exceed $2 \cdot 10^5$.


-----Output-----

For each test case, print $n$ choices $c_1 c_2 \dots c_n$ to maximize the average number of wins. Print them in the same manner as the string $s$.

If there are multiple optimal answers, print any of them.


-----Example-----
Input
3
RRRR
RSP
S

Output
PPPP
RSP
R


-----Note-----

In the first test case, the bot (wherever it starts) will always choose "Rock", so we can always choose "Paper". So, in any case, we will win all $n = 4$ rounds, so the average is also equal to $4$.

In the second test case:   if bot will start from $pos = 1$, then $(s_1, c_1)$ is draw, $(s_2, c_2)$ is draw and $(s_3, c_3)$ is draw, so $win(1) = 0$;  if bot will start from $pos = 2$, then $(s_2, c_1)$ is win, $(s_3, c_2)$ is win and $(s_1, c_3)$ is win, so $win(2) = 3$;  if bot will start from $pos = 3$, then $(s_3, c_1)$ is lose, $(s_1, c_2)$ is lose and $(s_2, c_3)$ is lose, so $win(3) = 0$;  The average is equal to $\frac{0 + 3 + 0}{3} = 1$ and it can be proven that it's the maximum possible average.

A picture from Wikipedia explaining "Rock paper scissors" game:  $\beta$

Difficulty: MEDIUM
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
n = int(input())
for _ in range(n):
	s = input()
	num_dict = {}
	for i in s:
		if i in num_dict.keys():
			num_dict[i] += 1
		else:
			num_dict[i] = 1
	final = ''
	key = max(num_dict, key=num_dict.get)
	value = num_dict[key]
	if key == 'P':
		final += 'S' * len(s)
	elif key == 'S':
		final += 'R' * len(s)
	else:
		final += 'P' * len(s)
	print(final)


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False

def find_dividers(x):
	dividers = []
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			dividers.append(i)
			if i * i != x:
				dividers.append(x // i)
	return dividers
for _ in range(int(input())):
	s = input()
	amount = dict()
	for x in s:
		if x == 'R':
			amount.setdefault('R', 0)
			amount['R'] += 1
		elif x == 'S':
			amount.setdefault('S', 0)
			amount['S'] += 1
		else:
			amount.setdefault('P', 0)
			amount['P'] += 1
	letter = max(amount, key=amount.get)
	if letter == 'R':
		print('P' * len(s))
	elif letter == 'S':
		print('R' * len(s))
	else:
		print('S' * len(s))


from collections import Counter
for s in range(int(input())):
	a = {'R': 'P', 'P': 'S', 'S': 'R'}
	h = input()
	i = Counter(h).most_common()[0][0]
	print(a[i] * len(h))


import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]
from math import ceil

def lmii():
	return list(map(int, input().split()))
d = {'R': 'P', 'S': 'R', 'P': 'S'}
t = int(input())
for i in range(t):
	a = input()
	s = Counter(a)
	print(d[s.most_common(1)[0][0]] * len(a))


def solve():
	from collections import Counter
	t = int(input())
	for _ in range(t):
		s = input()
		l = len(s)
		c = Counter(s)
		ma = max(c, key=c.get)
		if ma == 'R':
			ma = 'P'
		elif ma == 'P':
			ma = 'S'
		else:
			ma = 'R'
		print(ma * l)
solve()


from collections import Counter
t = int(input())
for _ in range(t):
	mas = input()
	count = Counter(mas).most_common()
	if count[0][0] == 'R':
		str = 'P'
	elif count[0][0] == 'P':
		str = 'S'
	else:
		str = 'R'
	stonks = str * len(mas)
	print(stonks)


from sys import stdin
input = lambda : stdin.readline().rstrip('\r\n')
from collections import deque as que
from collections import defaultdict as vector
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))

def SOLVEA():
	n = inin()
	a = inar()
	for i in range(1, n - 1):
		if a[i - 1] < a[i] > a[i + 1]:
			print('YES')
			print(i, i + 1, i + 2)
			break
	else:
		print('NO')

def SOLVEB():
	s = input()
	n = len(s)
	mc = max(s.count('P'), s.count('S'), s.count('R'))
	if s.count('R') == mc:
		print('P' * n)
	elif s.count('P') == mc:
		print('S' * n)
	else:
		print('R' * n)
Testcase = inin()
for _ in range(Testcase):
	SOLVEB()


for _ in range(int(input())):
	arr = list(input())
	a = arr.count('R')
	b = arr.count('P')
	c = arr.count('S')
	if a == b == c:
		print(''.join(arr))
	elif a is max(a, b, c):
		arr2 = ['P'] * len(arr)
		print(''.join(arr2))
	elif b is max(a, b, c):
		arr2 = ['S'] * len(arr)
		print(''.join(arr2))
	else:
		arr2 = ['R'] * len(arr)
		print(''.join(arr2))


import sys
import math
import collections
import heapq

def set_debug(debug_mode=False):
	if debug_mode:
		fin = open('input.txt', 'r')
		sys.stdin = fin

def int_input():
	return list(map(int, input().split()))
t = int(input())
for ti in range(1, t + 1):
	s = input()
	c = collections.Counter(s)
	m = max(c['R'], c['S'], c['P'])
	if m == c['R']:
		print('P' * len(s))
	elif m == c['S']:
		print('R' * len(s))
	else:
		print('S' * len(s))


import sys
input = sys.stdin.readline
from collections import Counter
for _ in range(int(input())):
	s = input().rstrip()
	c = Counter(s)
	v = c.most_common()
	if v[0][0] == 'R':
		print('P' * len(s))
	elif v[0][0] == 'S':
		print('R' * len(s))
	else:
		print('S' * len(s))


w = int(input())
for aaa in range(w):
	r = input()
	d = {'R': 0, 'S': 0, 'P': 0}
	for x in r:
		d[x] += 1
	s = max(map(lambda x: tuple(reversed(x)), d.items()))
	l = None
	if s[1] == 'R':
		l = 'P'
	elif s[1] == 'S':
		l = 'R'
	else:
		l = 'S'
	print(l * len(r))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		s = input()
		le = len(s)
		a = b = c = 0
		for i in s:
			if i == 'R':
				a += 1
			if i == 'S':
				b += 1
			if i == 'P':
				c += 1
		ma = max(a, b, c)
		if ma == a:
			print('P' * le)
		elif ma == b:
			print('R' * le)
		elif ma == c:
			print('S' * le)
main()


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	s = input().strip()
	a = []
	p = s.count('R')
	q = s.count('P')
	r = s.count('S')
	if p >= q and p >= r:
		print('P' * len(s))
	elif q >= p and q >= r:
		print('S' * len(s))
	else:
		print('R' * len(s))
for _ in range(I()):
	solve()


for _ in range(int(input())):
	s = input()
	d = {'R': 0, 'S': 0, 'P': 0}
	for i in s:
		d[i] += 1
	mx = 'R'
	for i in d:
		if d[i] > d[mx]:
			mx = i
	d2 = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(d2[mx] * len(s))


from collections import Counter
for _ in range(int(input())):
	s = input()
	cnt = Counter(s)
	win = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(''.join((win[cnt.most_common(1)[0][0]] for _ in s)))


t = int(input())
while t:
	t -= 1
	s = input()
	n = len(s)
	d = {'R': 0, 'P': 0, 'S': 0}
	for i in range(n):
		d[s[i]] += 1
	if d['R'] == max(d.values()):
		print('P' * n)
	elif d['P'] == max(d.values()):
		print('S' * n)
	elif d['S'] == max(d.values()):
		print('R' * n)


t = int(input())
for i in range(t):
	s = str(input())
	n = len(s)
	a = ''
	s1 = 0
	s2 = 0
	s3 = 0
	for j in range(n):
		if s[j] == 'R':
			s1 += 1
		elif s[j] == 'P':
			s2 += 1
		else:
			s3 += 1
	lis = [s1, s2, s3]
	lis.sort()
	if lis[-1] != lis[-2]:
		if s1 == lis[-1]:
			for j in range(n):
				a += 'P'
			print(a)
		elif s2 == lis[-1]:
			for j in range(n):
				a += 'S'
			print(a)
		else:
			for j in range(n):
				a += 'R'
			print(a)
	elif lis[-1] == lis[-2] and lis[-2] != lis[-3]:
		if s1 == lis[0]:
			for j in range(n):
				a += 'R'
			print(a)
		elif s2 == lis[0]:
			for j in range(n):
				a += 'P'
			print(a)
		else:
			for j in range(n):
				a += 'S'
			print(a)
	else:
		for j in range(n):
			a += 'P'
		print(a)


import math
t = int(input())
for w in range(t):
	s = input()
	n = len(s)
	l = [0] * 3
	for i in s:
		if i == 'R':
			l[0] += 1
		elif i == 'S':
			l[1] += 1
		else:
			l[2] += 1
	k = max(l)
	if k == l[0]:
		print('P' * n)
	elif k == l[1]:
		print('R' * n)
	else:
		print('S' * n)


for _ in range(int(input())):
	s = input()
	n = len(s)
	a = s.count('R')
	b = s.count('P')
	c = s.count('S')
	m = max(a, max(b, c))
	if m == a:
		print('P' * n)
	elif m == b:
		print('S' * n)
	else:
		print('R' * n)


t = int(input())
for i in range(t):
	s = input()
	R = 0
	P = 0
	S = 0
	n = len(s)
	for j in range(n):
		if s[j] == 'R':
			R += 1
		elif s[j] == 'S':
			S += 1
		else:
			P += 1
	m = max(R, S, P)
	if m == R:
		print(n * 'P')
	elif m == S:
		print(n * 'R')
	else:
		print(n * 'S')


t = int(input())
for hh in range(0, t):
	s = input()
	s = list(s)
	n = len(s)
	scount = 0
	pcount = 0
	rcount = 0
	for i in range(0, n):
		if s[i] == 'R':
			rcount += 1
		elif s[i] == 'S':
			scount += 1
		elif s[i] == 'P':
			pcount += 1
	mx = max(scount, pcount, rcount)
	if mx == scount:
		ans = 'R' * n
	elif mx == rcount:
		ans = 'P' * n
	elif mx == pcount:
		ans = 'S' * n
	print(ans)


from collections import *
t = 'RPSR'
for s in [*open(0)][1:]:
	print(t[t.find(Counter(s).most_common()[0][0]) + 1] * (len(s) - 1))


t = int(input())
for i in range(t):
	s1 = input()
	s = list(s1)
	l = len(s1)
	hm = {}
	hm['R'] = 0
	hm['S'] = 0
	hm['P'] = 0
	for j in s:
		hm[j] += 1
	if hm['R'] == hm['S'] and hm['R'] == hm['P']:
		print(s1)
		continue
	q = max(hm, key=hm.get)
	if q == 'R':
		print('P' * l)
		continue
	if q == 'S':
		print('R' * l)
		continue
	if q == 'P':
		print('S' * l)
		continue


import sys
from collections import defaultdict as dd
from collections import deque
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [x for x in input().split()]

def fi():
	return int(input())

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)

def bo(i):
	return ord(i) - ord('a')
t = fi()
while t > 0:
	t -= 1
	s = si()
	n = len(s)
	r = s.count('R')
	p = s.count('P')
	ss = n - r - p
	if r >= ss and r >= p:
		print(n * 'P')
	elif p >= ss and p >= r:
		print(n * 'S')
	else:
		print(n * 'R')


import sys
input = sys.stdin.readline
from collections import Counter
result = {'R': 'P', 'P': 'S', 'S': 'R'}
n = int(input())
for _ in range(n):
	s = list(input().strip())
	cnt = Counter(s)
	most_common_char = cnt.most_common(1)[0][0]
	print(result[most_common_char] * len(s))


t = int(input())
for _ in range(t):
	stri = input()
	n = len(stri)
	num_r = 0
	num_s = 0
	num_p = 0
	for i in stri:
		if i == 'P':
			num_p += 1
		elif i == 'R':
			num_r += 1
		else:
			num_s += 1
	if num_p >= num_s and num_p >= num_r:
		for i in range(n):
			print('S', end='')
		print()
	elif num_s >= num_p and num_s >= num_r:
		for i in range(n):
			print('R', end='')
		print()
	else:
		for i in range(n):
			print('P', end='')
		print()


n = int(input())
for i in range(n):
	string = str(input())
	flag = 0
	r = 0
	s = 0
	p = 0
	for j in range(0, len(string)):
		if string[j] == 'R':
			r = r + 1
		elif string[j] == 'S':
			s = s + 1
		elif string[j] == 'P':
			p = p + 1
	m = 0
	if r >= s:
		if r >= p:
			for j in range(len(string)):
				print('P', end='')
			print()
		elif p >= s:
			for j in range(len(string)):
				print('S', end='')
			print()
		elif s >= p:
			for j in range(len(string)):
				print('R', end='')
			print()
		elif len(string) == 2:
			if s == 0:
				print('SS')
			elif r == 0:
				print('RR')
			elif p == 0:
				print('PP')
		else:
			print(string)
	elif s >= p:
		for j in range(len(string)):
			print('R', end='')
		print()
	elif p >= s:
		for j in range(len(string)):
			print('S', end='')
		print()
	elif len(string) == 2:
		if s == 0:
			print('SS')
		elif r == 0:
			print('RR')
		elif p == 0:
			print('PP')
	else:
		print(string)


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	c = Counter(s)
	r = c['R']
	s = c['S']
	p = c['P']
	a = max(r, s, p)
	if a == r:
		ans = 'P' * n
	if a == s:
		ans = 'R' * n
	if a == p:
		ans = 'S' * n
	print(ans)


import math
from decimal import *
import random
mod = int(1000000000.0) + 7
for _ in range(int(input())):
	d = {'R': 0, 'P': 0, 'S': 0}
	s = str(input())
	for i in range(len(s)):
		if s[i] == 'R':
			d['P'] += 1
		if s[i] == 'P':
			d['S'] += 1
		if s[i] == 'S':
			d['R'] += 1
	mx = 0
	let = ''
	for x in d:
		if d[x] > mx:
			mx = d[x]
			let = x
	print(let * len(s))


from sys import *
input = stdin.readline
T = int(input())
for case in range(T):
	Combs = list(input().rstrip())
	L = len(Combs)
	(r, s, p) = (0, 0, 0)
	for i in Combs:
		if i == 'R':
			p += 1
		elif i == 'S':
			r += 1
		elif i == 'P':
			s += 1
	if p == max([r, s, p]):
		Ans = 'P' * L
	elif r == max([r, s, p]):
		Ans = 'R' * L
	elif s == max([r, s, p]):
		Ans = 'S' * L
	print(Ans)


from collections import Counter
d = {'S': 'R', 'P': 'S', 'R': 'P'}
for _ in range(int(input())):
	s = input()
	c = Counter(s).most_common(1)[0][0]
	print(d[c] * len(s))


cases = int(input())
for i in range(cases):
	s = input()
	rock = 'R'
	scis = 'S'
	pape = 'P'
	ans = ''
	r1 = s.count(rock)
	s1 = s.count(scis)
	p1 = s.count(pape)
	ma = max(r1, s1, p1)
	if ma == r1:
		ans += len(s) * 'P'
	elif ma == s1:
		ans += len(s) * 'R'
	elif ma == p1:
		ans += len(s) * 'S'
	print(ans)


for _ in range(int(input())):
	s = input()
	n = len(s)
	d = {}
	p = ''
	d['R'] = 0
	d['P'] = 0
	d['S'] = 0
	for i in range(0, n):
		if s[i] == 'R':
			if d.get('R') == None:
				d['R'] = 1
			else:
				d['R'] += 1
		elif s[i] == 'P':
			if d.get('P') == None:
				d['P'] = 1
			else:
				d['P'] += 1
		elif s[i] == 'S':
			if d.get('S') == None:
				d['S'] = 1
			else:
				d['S'] += 1
	a = d['R']
	b = d['P']
	c = d['S']
	ma = max(d['R'], d['S'], d['P'])
	if d['R'] == d['S']:
		rs = d['R']
	elif d['R'] == d['P']:
		rp = d['R']
	elif d['P'] == d['S']:
		ps = d['S']
	if d['R'] == n:
		for i in range(n):
			p += 'P'
		print(p)
	elif d['S'] == n:
		for i in range(n):
			p += 'R'
		print(p)
	elif d['P'] == n:
		for i in range(n):
			p += 'S'
		print(p)
	elif d['R'] == d['S'] and d['S'] == d['P']:
		print(s)
	elif d['R'] != d['S'] or d['S'] != d['P']:
		if d['R'] == d['S']:
			if a > b:
				for i in range(rs):
					p += 'P'
				l = n - rs
				for i in range(l):
					p += 'P'
				print(p)
			else:
				for i in range(n):
					p += 'S'
				print(p)
		elif d['R'] == d['P']:
			if a > c:
				for i in range(rp):
					p += 'S'
				l = n - rp
				for i in range(l):
					p += 'S'
				print(p)
			else:
				for i in range(n):
					p += 'R'
				print(p)
		elif d['P'] == d['S']:
			if a < b:
				for i in range(ps):
					p += 'R'
				l = n - ps
				for i in range(l):
					p += 'R'
				print(p)
			else:
				for i in range(n):
					p += 'P'
				print(p)
		elif a > b and a > c:
			for i in range(n):
				p += 'P'
			print(p)
		elif b > a and b > c:
			for i in range(n):
				p += 'S'
			print(p)
		elif c > b and c > a:
			for i in range(n):
				p += 'R'
			print(p)


t = int(input())
for i in range(t):
	map = {'R': 0, 'S': 0, 'P': 0}
	seq = str(input())
	n = len(seq)
	for s in seq:
		map[s] += 1
	if map['R'] >= map['S'] and map['R'] >= map['P']:
		maxs = 'P'
	elif map['S'] >= map['R'] and map['S'] >= map['P']:
		maxs = 'R'
	elif map['P'] >= map['R'] and map['P'] >= map['S']:
		maxs = 'S'
	print(''.join([maxs] * n))


for _ in range(int(input())):
	si = input()
	r = s = p = 0
	n = len(si)
	for i in si:
		if i == 'S':
			s += 1
		elif i == 'R':
			r += 1
		else:
			p += 1
	m = max(s, p, r)
	l = [('S', 'R'), ('R', 'P'), ('P', 'S')]
	if m == s:
		print(n * 'R')
	elif m == p:
		print(n * 'S')
	else:
		print(n * 'P')


for _ in range(int(input())):
	s = input()
	cntS = cntP = cntR = 0
	for x in s:
		if x == 'P':
			cntP += 1
		elif x == 'S':
			cntS += 1
		else:
			cntR += 1
	if cntR == max(cntR, cntS, cntP):
		print('P' * len(s))
	elif cntS == max(cntR, cntS, cntP):
		print('R' * len(s))
	elif cntP == max(cntR, cntS, cntP):
		print('S' * len(s))


from collections import Counter
t = int(input())
for _ in range(t):
	cnts = Counter(input())
	allR = cnts['S']
	allS = cnts['P']
	allP = cnts['R']
	l = [('R', allR), ('S', allS), ('P', allP)]
	l.sort(key=lambda x: x[1], reverse=True)
	print(l[0][0] * sum(cnts.values()))


import collections
output = []
int = int
len = len
str = str
abs = abs

def main():
	Win = {}
	Win['P'] = 'S'
	Win['S'] = 'R'
	Win['R'] = 'P'
	for _ in range(int(input())):
		s = input()
		A = list(s)
		Dict = collections.Counter(A)
		maxKey = max(Dict.values())
		A = [x for x in Dict.keys() if Dict[x] == maxKey]
		if len(A) == 3:
			output.append(s)
		else:
			output.append(Win[A[0]] * len(s))
main()
print('\n'.join(output))


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in R(V)]
	FromStdin = True if ls == None else False
	for i in R(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()

class matrix:

	class MulShapeError(Exception):
		pass

	def __init__(self, arr_input):
		if hasattr(arr_input[0], '__getitem__'):
			self.arr = arr_input
		else:
			self.arr = [arr_input]
		self.shape = (len(self.arr), len(self.arr[0]))

	def __getitem__(self, key):
		return self.arr[key]

	def __setitem__(self, key, value):
		self.arr[key] = value

	def __iter__(self):
		return iter(self.arr)

	def __add__(self, B):
		if type(B) != matrix:
			return NotImplemented
		if B.shape != self.shape:
			return NotImplemented
		rt = [[0] * self.shape[1] for i in range(self.shape[0])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				rt[i][j] = self.arr[i][j] + B.arr[i][j]
		return matrix(rt)

	def __iadd__(self, B):
		return self.__add__(B)

	def __sub__(self, B):
		if type(B) != matrix:
			return NotImplemented
		if B.shape != self.shape:
			return NotImplemented
		rt = [[0] * self.shape[1] for i in range(self.shape[0])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				rt[i][j] = self.arr[i][j] - B.arr[i][j]
		return matrix(rt)

	def __isub__(self, B):
		return self.__sub__(B)

	def __mul__(self, M):
		if type(M) in [int, float, complex]:
			M = matrix([[M * (i == j) for j in range(self.shape[1])] for i in range(self.shape[1])])
		if type(M) != matrix:
			return NotImplemented
		if M.shape[0] != self.shape[1]:
			raise matrix.MulShapeError('mult is not applicable between the matrices of shape ' + str(self.shape) + ' and ' + str(M.shape))
		(ra, ca) = self.shape
		(rb, cb) = M.shape
		c = [[0] * cb for i in range(ra)]
		for i in range(ra):
			for j in range(cb):
				for k in range(ca):
					c[i][j] += self.arr[i][k] * M.arr[k][j]
		return matrix(c)

	def __imul__(self, M):
		return self.__mul__(M)

	def __rmul__(self, M):
		if type(M) in [int, float, complex]:
			M = matrix([[M * (i == j) for j in range(self.shape[1])] for i in range(self.shape[1])])
		if type(M) != matrix:
			return NotImplemented
		if M.shape[0] != self.shape[1]:
			raise matrix.MulShapeError('mult is not applicable between the matrix shape ' + str(self.shape) + ' and ' + str(M.shape))
		(ra, ca) = M.shape
		(rb, cb) = self.shape
		c = [[0] * cb for i in range(ra)]
		for i in range(ra):
			for j in range(cb):
				for k in range(ca):
					c[i][j] += M.arr[i][k] * self.arr[k][j]
		return matrix(c)

	def __mod__(self, p):
		if type(p) != int:
			return NotImplemented
		c = [[0] * self.shape[1] for i in range(self.shape[0])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				c[i][j] = self.arr[i][j] % p
		return matrix(c)

	def __imod__(self, p):
		return self.__mod__(p)

	def __pow__(self, p, mod=10 ** 9 + 7):
		if type(p) != int or self.shape[0] != self.shape[1]:
			return NotImplemented
		A = matrix(self.arr)
		R = matrix([[1 * (i == j) for j in range(self.shape[0])] for i in range(self.shape[0])])
		while p > 0:
			if p & 1:
				R *= A
				R %= mod
			A *= A
			A %= mod
			p >>= 1
		return R

	def __neg__(self):
		return self.__mul__(-1)

	def __str__(self):
		rt = '['
		for i in self.arr:
			rt = rt + str(i) + ',\n'
		return rt[:-2] + ']'

	def T(self):
		rt = [[0] * self.shape[0] for i in range(self.shape[1])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				rt[j][i] = self.arr[i][j]
		return matrix(rt)

	def resize(self, new_shape, fill=0):
		t_arr = []
		for i in self.arr:
			t_arr += i
		t_arr.reverse()
		(n, m) = new_shape
		self.shape = (n, m)
		self.arr = [[fill] * m for i in range(n)]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				if t_arr:
					self.arr[i][j] = t_arr.pop()
		return

	def view(self):
		for i in self.arr:
			print(i)
show_flg = False
show_flg = True
d = dict(zip('RSP', 'PRS'))
for _ in range(I()):
	s = input()
	x = 0
	y = -1
	for (i, j) in enumerate('RSP'):
		t = s.count(j)
		if t > y:
			x = i
			y = t
	print(d['RSP'[x]] * len(s))


t = int(input())
for i in range(t):
	inputs = input()
	s = 0
	p = 0
	r = 0
	for i in range(len(inputs)):
		if inputs[i] == 'P':
			s += 1
		elif inputs[i] == 'R':
			p += 1
		elif inputs[i] == 'S':
			r += 1
	if s >= r and s >= p:
		print((s + p + r) * 'S')
	elif r >= s and r >= p:
		print((s + p + r) * 'R')
	else:
		print((s + p + r) * 'P')


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	s = SI()
	ans = ''
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	m = 0
	if s.count('R') > m:
		m = s.count('R')
		ans = 'R'
	if s.count('S') > m:
		m = s.count('S')
		ans = 'S'
	if s.count('P') > m:
		ans = 'P'
	ans = d[ans]
	print(ans * len(s))


from collections import Counter
for _ in range(int(input())):
	inp = input()
	inps = Counter(inp)
	maxs = inps.most_common(1)[0][0]
	dcts = {'R': 'P', 'S': 'R', 'P': 'S'}
	answ = dcts[maxs] * len(inp)
	print(answ)


from collections import Counter
T = int(input())
for t in range(T):
	s = input()
	cc = Counter(s)
	fl = cc.most_common()[0][0]
	if fl == 'R':
		choice = 'P'
	elif fl == 'S':
		choice = 'R'
	else:
		choice = 'S'
	print(choice * len(s))


import sys
print = sys.stdout.write
dic = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(int(input())):
	s = input()
	a = max(['R', 'P', 'S'], key=s.count)
	print(dic[a] * len(s) + '\n')


test_case = int(input())
for _ in range(test_case):
	st = input()
	x = [0, 0, 0]
	for i in st:
		if i == 'R':
			x[0] += 1
		elif i == 'S':
			x[1] += 1
		else:
			x[2] += 1
	y = {'P': x[0], 'R': x[1], 'S': x[2]}
	y = sorted(y.items(), key=lambda m: m[1])
	print(y[2][0] * len(st))


from collections import Counter
t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	s = input()
	tot = len(s)
	s = Counter(s)
	a = s.most_common(1)
	if a[0][0] == 'R':
		print('P' * tot)
	elif a[0][0] == 'S':
		print('R' * tot)
	else:
		print('S' * tot)


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	ss = sys.stdin.readline().strip()
	ans = {}
	ans['S'] = ss.count('P')
	ans['P'] = ss.count('R')
	ans['R'] = ss.count('S')
	inverse = [(value, key) for (key, value) in ans.items()]
	aa = max(inverse)[1]
	print(''.join([aa for _ in range(len(ss))]))


import math
import os
import sys
input = lambda : sys.stdin.readline().strip('\r\n')

def cin():
	return sys.stdin.readline().strip('\r\n')

def fora():
	return list(map(int, sys.stdin.readline().strip().split()))

def string():
	return sys.stdin.readline().strip()

def cout(ans):
	sys.stdout.write(str(ans))

def endl():
	sys.stdout.write(str('\n'))

def ende():
	sys.stdout.write(str(' '))

def main():
	for _ in range(int(input())):
		s = string()
		mp = {}
		mp = dict.fromkeys(s, 0)
		maxt = 0
		for i in s:
			mp[i] += 1
			maxt = max(maxt, mp[i])
		for i in mp:
			if mp[i] == maxt:
				if i == 'P':
					p = 'S'
				elif i == 'R':
					p = 'P'
				else:
					p = 'R'
				for j in range(len(s)):
					cout(p)
				break
		endl()
main()


t = int(input())
for _ in range(t):
	s = input()
	c = 0
	d = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		for x in d:
			c = 0
			if x == 'R':
				if i == 'R':
					pass
				elif i == 'P':
					pass
				else:
					c += 1
			elif x == 'P':
				if i == 'P':
					pass
				elif i == 'R':
					c += 1
				else:
					pass
			elif i == 'S':
				pass
			elif i == 'P':
				c += 1
			else:
				pass
			d[x] += c
	key = 'R'
	val = d['R']
	for i in d:
		if d[i] > val:
			val = d[i]
			key = i
	print(key * len(s))


for _ in range(int(input())):
	s = input()
	dem1 = 0
	dem2 = 0
	dem3 = 0
	result = ''
	dem1 = s.count('R')
	dem2 = s.count('S')
	dem3 = s.count('P')
	m = max(dem1, dem2, dem3)
	if dem1 == m:
		ans = 'P'
	elif dem2 >= dem3 and dem2 >= dem1:
		ans = 'R'
	else:
		ans = 'S'
	print(ans * len(s))


t = int(input())
for _ in range(t):
	st = input()
	ar = dict()
	for i in st:
		ar[i] = ar.get(i, 0) + 1
	s = ar.get('S', 0)
	p = ar.get('P', 0)
	r = ar.get('R', 0)
	if s >= p and s >= r:
		ans = len(st) * 'R'
	elif p >= r and p >= s:
		ans = len(st) * 'S'
	else:
		ans = len(st) * 'P'
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	cnt_r = s.count('R')
	cnt_s = s.count('S')
	cnt_p = s.count('P')
	max_cnt = max(cnt_r, cnt_s, cnt_p)
	if max_cnt == cnt_r:
		print('P' * n)
	elif max_cnt == cnt_s:
		print('R' * n)
	else:
		print('S' * n)


import sys
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

def solve():
	s = input()
	n = len(s)
	r = {'R': 'P', 'S': 'R', 'P': 'S'}
	d = {}
	sm = 0
	for i in 'RSP':
		d[i] = s.count(i)
		sm += d[i]
	ok = {'R': 'SP', 'S': 'RP', 'P': 'RS'}
	for i in ok:
		if d[i] >= d[ok[i][0]] and d[i] >= d[ok[i][1]]:
			print(r[i] * n)
			return
	print(r[s[0]] * n)
(t,) = I()
while t:
	t -= 1
	solve()


for T in range(int(input())):
	s = input()
	num = {'R': 0, 'S': 0, 'P': 0}
	trans = {'R': 'P', 'S': 'R', 'P': 'S'}
	for i in s:
		num[i] += 1
	mx = max(num.values())
	for i in num.keys():
		if num[i] == mx:
			for j in s:
				print(trans[i], end='')
			print()
			break


def maximum(a, b, c):
	list = [a, b, c]
	return max(list)
n = int(input())
for i in range(0, n):
	s = str(input())
	a = list(s)
	countp = 0
	counts = 0
	countr = 0
	b = len(s)
	for j in range(b):
		if a[j] == 'R':
			countr += 1
		elif a[j] == 'P':
			countp += 1
		elif a[j] == 'S':
			counts += 1
	x = maximum(counts, countp, countr)
	if countp == x:
		for j in range(b):
			a[j] = 'S'
	if counts == x:
		for j in range(b):
			a[j] = 'R'
	if countr == x:
		for j in range(b):
			a[j] = 'P'
	z = ''.join(a)
	print(z)


for _ in range(int(input())):
	S = input()
	(r, p, s) = (S.count('R'), S.count('P'), S.count('S'))
	ans = 'R'
	if r >= p and r >= s:
		ans = 'P'
	if p >= r and p >= s:
		ans = 'S'
	print(ans * len(S))


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	s = input()
	d = {}
	for ele in s:
		d[ele] = d.get(ele, 0) + 1
	d = sorted(d.items(), key=lambda x: x[1], reverse=True)
	f = {'R': 'P', 'S': 'R', 'P': 'S'}
	new = f[d[0][0]] * len(s)
	P(new)
t = II()
for i in range(t):
	solve()


for _ in range(int(input())):
	s = list(input())
	s1 = set(s)
	if len(s1) == 1:
		if s[0] == 'R':
			print('P' * len(s))
		elif s[0] == 'P':
			print('S' * len(s))
		else:
			print('R' * len(s))
	else:
		p = s.count('P')
		r = s.count('R')
		ss = s.count('S')
		m = max(p, r, ss)
		if m == p:
			print('S' * len(s))
		elif m == r:
			print('P' * len(s))
		else:
			print('R' * len(s))


for _ in range(int(input())):
	s = input()
	freq = {'R': 0, 'P': 0, 'S': 0}
	for ch in s:
		freq[ch] += 1
	if freq['R'] == max(freq.values()):
		print('P' * len(s))
	elif freq['P'] == max(freq.values()):
		print('S' * len(s))
	elif freq['S'] == max(freq.values()):
		print('R' * len(s))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	s = input()
	rock = s.count('R')
	paper = s.count('P')
	scissor = s.count('S')
	mx = max(rock, paper, scissor)
	if mx == rock:
		print('P' * len(s), sep='')
	elif mx == paper:
		print('S' * len(s), sep='')
	else:
		print('R' * len(s), sep='')


for ty in range(int(input())):
	s = list(input())
	p = 0
	r = 0
	o = 0
	for i in range(len(s)):
		if s[i] == 'R':
			s[i] = 'P'
			p += 1
		elif s[i] == 'S':
			s[i] = 'R'
			r += 1
		else:
			s[i] = 'S'
			o += 1
	if max(p, o, r) == p:
		print('P' * len(s))
	elif max(p, o, r) == o:
		print('S' * len(s))
	else:
		print('R' * len(s))


def main():
	from sys import stdin, stdout
	for _ in range(int(stdin.readline())):
		inp = stdin.readline().strip()
		counter = {}
		for i in inp:
			if i not in counter:
				counter[i] = 1
			else:
				counter[i] += 1
		maxim = -1000000000.0
		maxletter = None
		for i in counter:
			if counter[i] > maxim:
				maxim = counter[i]
				maxletter = i
		ans = 'R' if maxletter == 'S' else 'S' if maxletter == 'P' else 'P'
		ans = ans * len(inp)
		stdout.write(ans + '\n')
main()


t = int(input())
for i in range(t):
	S = input()
	l = len(S)
	r = S.count('R')
	s = S.count('S')
	p = S.count('P')
	m = max(r, s, p)
	if m == r:
		print('P' * l)
	elif m == s:
		print('R' * l)
	else:
		print('S' * l)


numberOfTc = int(input())
for ctr in range(1, numberOfTc + 1):
	a = input().strip()
	rCount = a.count('R')
	sCount = a.count('S')
	pCount = a.count('P')
	f = [rCount, sCount, pCount]
	k = ['P', 'R', 'S']
	ind = k[f.index(max(f))]
	print(ind * len(a))


import math
t = int(input())
for i in range(t):
	s1 = input()
	l = len(s1)
	s = ''
	c1 = 0
	c2 = 0
	c3 = 0
	for e in s1:
		if e == 'P':
			c1 = c1 + 1
		if e == 'R':
			c2 = c2 + 1
		if e == 'S':
			c3 = c3 + 1
	flag = 0
	if c1 >= c2 and c1 >= c3 and (flag == 0):
		s = 'S' * l
		flag = 1
		print(s)
	if c2 >= c1 and c2 >= c3 and (flag == 0):
		s = 'P' * l
		flag = 1
		print(s)
	if c3 >= c2 and c3 >= c1 and (flag == 0):
		s = 'R' * l
		print(s)


for _ in range(int(input())):
	s = input()
	cr = s.count('R')
	cp = s.count('P')
	cs = s.count('S')
	if cr >= cp and cr >= cs:
		print('P' * len(s))
	elif cp >= cr and cp >= cs:
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
beating = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(t):
	s = input()
	counts = [s.count('R'), s.count('P'), s.count('S')]
	if counts[0] == max(counts):
		print(beating['R'] * len(s))
	elif counts[1] == max(counts):
		print(beating['P'] * len(s))
	else:
		print(beating['S'] * len(s))


t = int(input())
for _t in range(t):
	s = input()
	h = ['R', 'P', 'S']
	h2 = ['R', 'P', 'S', 'R']
	m = 0
	sol = ''
	for k in range(len(h)):
		if s.count(h[k]) > m:
			m = s.count(h[k])
			sol = h2[k + 1]
	for i in range(len(s)):
		print(sol, end='')
	print('')


for i in range(int(input())):
	stk = input()
	srt = ''.join(list(set([x for x in stk])))
	mx = 0
	for i in range(len(srt)):
		if stk.count(srt[i]) > mx:
			mx = stk.count(srt[i])
			k = srt[i]
	if k == 'R':
		print('P' * len(stk))
	elif k == 'P':
		print('S' * len(stk))
	else:
		print('R' * len(stk))


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	for _ in range(int(input())):
		a = input()
		s = a.count('S')
		r = a.count('R')
		p = a.count('P')
		if max(s, r, p) == s:
			print('R' * len(a))
		elif max(s, r, p) == r:
			print('P' * len(a))
		elif max(s, r, p) == p:
			print('S' * len(a))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for k in range(t):
	a = input()
	(r, s, p) = (a.count('R'), a.count('S'), a.count('P'))
	now = max(r, s, p)
	if r == now:
		ans = ''.join(['P' for i in range(len(a))])
	elif s == now:
		ans = ''.join(['R' for i in range(len(a))])
	else:
		ans = ''.join(['S' for i in range(len(a))])
	print(ans)


from sys import stdin, stdout

def universal_solution(s):
	n = len(s)
	R = P = S = 0
	for c in s:
		if c == 'R':
			R += 1
		elif c == 'P':
			P += 1
		else:
			S += 1
	if R >= P and R >= S:
		return ['P'] * n
	elif P >= R and P >= S:
		return ['S'] * n
	else:
		return ['R'] * n
t = int(stdin.readline())
for i in range(t):
	s = stdin.readline().strip()
	res = universal_solution(s)
	stdout.write(''.join(res) + '\n')


t = int(input())
while t != 0:
	t -= 1
	string = input()
	r = 0
	p = 0
	s = 0
	for x in string:
		if x == 'R':
			r += 1
		elif x == 'P':
			p += 1
		else:
			s += 1
	if r == max([r, p, s]):
		print('P' * len(string))
	elif p == max([r, p, s]):
		print('S' * len(string))
	else:
		print('R' * len(string))


for _ in range(int(input())):
	c = input()
	(p, r, s) = (0, 0, 0)
	for i in range(len(c)):
		if c[i] == 'R':
			r += 1
		elif c[i] == 'S':
			s += 1
		else:
			p += 1
	x = max({p, r, s})
	if x == p:
		for i in range(len(c)):
			print('S', end='')
	elif x == r:
		for i in range(len(c)):
			print('P', end='')
	else:
		for i in range(len(c)):
			print('R', end='')
	print()


def tell(a, n):
	c = [[0, 'R'], [0, 'P'], [0, 'S']]
	for i in range(n):
		if a[i] == 'R':
			c[1][0] += 1
		elif a[i] == 'P':
			c[2][0] += 1
		else:
			c[0][0] += 1
	c.sort()
	return c[-1][1] * n
number_o_v = int(input())
for i in range(number_o_v):
	a = str(input())
	n = len(a)
	s = tell(a, n)
	print(s)


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for tests in range(t):
	S = input().strip()
	C2 = Counter(S)
	C = C2.most_common()
	if C[0][0] == 'S':
		print('R' * len(S))
	elif C[0][0] == 'R':
		print('P' * len(S))
	else:
		print('S' * len(S))


from collections import defaultdict as dc
import sys
import math
mod = 10 ** 9 + 7

def sinp():
	p = str(sys.stdin.readline())
	return p

def seive(n):
	p = [0] * (n + 1)
	for i in range(2, n):
		for j in range(2 * i, n + 1, i):
			p[i] = 1
	return p

def inp():
	p = int(sys.stdin.readline())
	return p

def line():
	p = list(map(int, sys.stdin.readline().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def ind(a):
	return ord(a) - ord('A')

def digit(n):
	p = [int(i) for i in str(n)]
	return p

def check(s, k):
	for i in range(7):
		if s[i] != '?' and s[i] != k[i]:
			return 0
	return 1

def find_max(s, q, p):
	c = 0
	for i in range(len(s)):
		if p[s[i]] == q[i]:
			c += 1
	return c
t = inp()
for i in range(t):
	s = str(input())
	p = {'R': 'P', 'P': 'S', 'S': 'R'}
	c1 = s.count('R')
	c2 = s.count('P')
	c3 = s.count('S')
	n = len(s)
	z = max(c1, max(c2, c3))
	if z == c1:
		ans = p['R'] * n
		print(ans)
	elif z == c2:
		ans = p['P'] * n
		print(ans)
	else:
		ans = p['S'] * n
		print(ans)


import bisect as bi
import math as mt
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	s = input()
	f = {}
	f['S'] = 'R'
	f['R'] = 'P'
	f['P'] = 'S'
	ff = cc.Counter(s)
	x = max(ff, key=ff.get)
	print(f[x] * len(s))


__MULTITEST = True

def solve():
	s = str(input())
	play = {}
	play['R'] = 'P'
	play['P'] = 'S'
	play['S'] = 'R'
	maxChar = 'P'
	for p in ['R', 'S']:
		if s.count(p) > s.count(maxChar):
			maxChar = p
	tac = play[maxChar] * len(s)
	print(tac)
t = int(input()) if __MULTITEST else 1
for tt in range(t):
	solve()


import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve(lst):
	console('----- solving ------')
	c = Counter(lst)
	maxx = max(c['S'], c['P'], c['R'])
	if c['S'] == maxx:
		return 'R' * len(lst)
	if c['P'] == maxx:
		return 'S' * len(lst)
	if c['R'] == maxx:
		return 'P' * len(lst)
	return lst

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
for case_num in range(int(input())):
	strr = input()
	res = solve(strr)
	print(res)


ans = []
for _ in range(int(input())):
	s = list(input())
	n = len(s)
	cnt = [0] * 3
	for i in range(n):
		if s[i] == 'R':
			cnt[0] += 1
		elif s[i] == 'P':
			cnt[1] += 1
		else:
			cnt[2] += 1
	if cnt[0] == max(cnt):
		ansi = 'P' * n
	elif cnt[1] == max(cnt):
		ansi = 'S' * n
	else:
		ansi = 'R' * n
	ans.append(ansi)
print('\n'.join(ans))


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	s = stdin.readline().strip()
	(R, S, P) = (0, 0, 0)
	for c in s:
		if c == 'R':
			R += 1
		elif c == 'S':
			S += 1
		else:
			P += 1
	m = max(R, S, P)
	if m == R:
		a = 'P'
	elif m == S:
		a = 'R'
	else:
		a = 'S'
	stdout.write(a * len(s) + '\n')


for _ in range(int(input())):
	sl = input()
	(r, s, p) = (0, 0, 0)
	maxx = 0
	c = 'R'
	for i in sl:
		if i == 'R':
			r += 1
			if r > maxx:
				maxx = r
				c = 'P'
		elif i == 'S':
			s += 1
			if s > maxx:
				maxx = s
				c = 'R'
		else:
			p += 1
			if p > maxx:
				maxx = p
				c = 'S'
	print(c * len(sl))


import sys
input = sys.stdin.readline

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
for _ in range(int(input())):
	arr = list(input())
	n = len(arr)
	(r, p, s) = (arr.count('R'), arr.count('P'), arr.count('S'))
	maxi = max(r, p, s)
	if r == maxi:
		print('P' * (n - 1))
	elif p == maxi:
		print('S' * (n - 1))
	else:
		print('R' * (n - 1))


t = int(input())
for i in range(t):
	s = input()
	s.upper()
	rcnt = 0
	pcnt = 0
	scnt = 0
	for x in s:
		if x == 'R':
			rcnt += 1
		elif x == 'P':
			pcnt += 1
		elif x == 'S':
			scnt += 1
	if rcnt >= scnt and rcnt >= pcnt:
		print('P' * len(s))
	elif scnt >= rcnt and scnt >= pcnt:
		print('R' * len(s))
	elif pcnt >= rcnt and pcnt >= scnt:
		print('S' * len(s))


t = int(input())
for _ in range(t):
	bot_string_as_list = list(input())
	count_r = bot_string_as_list.count('R')
	count_s = bot_string_as_list.count('S')
	count_p = bot_string_as_list.count('P')
	max_count = max(count_r, count_s, count_p)
	if max_count == count_r:
		print('P' * len(bot_string_as_list))
	elif max_count == count_s:
		print('R' * len(bot_string_as_list))
	elif max_count == count_p:
		print('S' * len(bot_string_as_list))


t = int(input())
for _ in range(t):
	(rock, paper, scissors) = (0, 0, 0)
	line = input()
	for i in line:
		if i == 'R':
			rock += 1
		elif i == 'P':
			paper += 1
		else:
			scissors += 1
	n = len(line)
	if rock >= paper and rock >= scissors:
		print(n * 'P')
	elif paper >= rock and paper >= scissors:
		print(n * 'S')
	else:
		print(n * 'R')


for _ in range(int(input())):
	n = str(input())
	r = 0
	p = 0
	s = 0
	for i in n:
		if i == 'R':
			r += 1
		if i == 'P':
			p += 1
		if i == 'S':
			s += 1
	if r == p == s:
		print(n)
	elif max(r, p, s) == r:
		print('P' * len(n))
	elif max(r, p, s) == p:
		print('S' * len(n))
	elif max(r, p, s) == s:
		print('R' * len(n))


from collections import Counter

def solve():
	s = list(input())
	cs = Counter(s)
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	tmp = 0
	hand = 'R'
	for h in cs:
		if cs[h] > tmp:
			hand = h
			tmp = cs[h]
	print(win[hand] * len(s))
t = int(input())
for _ in range(t):
	solve()


s = int(input())
for tc in range(s):
	d = {}
	string = input()
	for i in string:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	sorted_d = sorted(d.items(), key=lambda x: x[1])
	letter = sorted_d[-1][0]
	if letter == 'R':
		ans = 'P'
	elif letter == 'P':
		ans = 'S'
	if letter == 'S':
		ans = 'R'
	for i in range(len(string)):
		print(ans, end='')
	print('')


t = int(input())
for _ in range(t):
	s = input()
	p = s.count('P')
	ss = s.count('S')
	r = s.count('R')
	if max(r, ss, p) == r:
		print('P' * len(s))
	elif max(r, ss, p) == ss:
		print('R' * len(s))
	elif max(r, ss, p) == p:
		print('S' * len(s))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
for _ in range(val()):
	s = st()
	cnt = Counter(s)
	l = sorted(cnt, key=lambda x: -cnt[x])
	if l[0] == 'R':
		ans = 'P'
	elif l[0] == 'S':
		ans = 'R'
	else:
		ans = 'S'
	print(ans * len(s))


t = int(input())
for _ in range(t):
	st = input()
	(r, p, s) = (0, 0, 0)
	for c in st:
		if c == 'R':
			r += 1
		if c == 'P':
			p += 1
		if c == 'S':
			s += 1
	if r == max([r, p, s]):
		print('P' * len(st))
	elif p == max([r, p, s]):
		print('S' * len(st))
	else:
		print('R' * len(st))


import collections
t = int(input())
for i in range(t):
	s = input()
	dc = {'R': 'P', 'P': 'S', 'S': 'R'}
	res = ''
	d = collections.defaultdict(int)
	for i in s:
		d[i] += 1
	maxv = 0
	maxc = ''
	for (k, v) in d.items():
		if v > maxv:
			maxv = v
			maxc = k
	ans = dc[maxc]
	res += ans * len(s)
	print(res)


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	s = input()
	n = len(s)
	r = s.count('R')
	sc = s.count('S')
	p = s.count('P')
	a = sorted([(r, 'P'), (sc, 'R'), (p, 'S')])
	print(a[-1][1] * n)
t = int(input())
for _ in range(t):
	main()


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')
from collections import Counter

def solve(s):
	c = Counter(s)
	mx = max(c.values())
	for (k, v) in c.items():
		if mx == v:
			if k == 'R':
				ws('P' * len(s))
			if k == 'S':
				ws('R' * len(s))
			if k == 'P':
				ws('S' * len(s))
			return

def main():
	for _ in range(ri()):
		s = rs()
		solve(s)
main()


def counter(s):
	if s == 'R':
		return 'P'
	elif s == 'P':
		return 'S'
	elif s == 'S':
		return 'R'
for t in range(int(input())):
	bot = input()
	n = len(bot)
	if len(set(bot)) == 1:
		print(counter(bot[0]) * n)
	else:
		d = {}
		l = ['R', 'P', 'S']
		for i in l:
			d[i] = bot.count(i)
		k = max(d, key=d.get)
		s = counter(k)
		print(s * n)


TC = int(input())
for tc in range(TC):
	S = input()
	P = 'RSP'
	r = 0
	s = 0
	p = 0
	for l in S:
		if l == 'R':
			r += 1
		elif l == 'S':
			s += 1
		else:
			p += 1
	maxi = max(r, p, s)
	if maxi == r:
		result = 'P' * len(S)
	elif maxi == p:
		result = 'S' * len(S)
	elif maxi == s:
		result = 'R' * len(S)
	else:
		result = 'NR'
	print(''.join(result))


for _ in range(int(input())):
	t = input()
	(r, s, p) = (t.count('R'), t.count('S'), t.count('P'))
	b = max(r, s, p)
	a = 'P' if r == b else 'R' if s == b else 'S'
	print(a * len(t))


from collections import Counter

def fast(S):
	n = len(S)
	ctr = Counter(S)
	c = ctr.most_common(1)[0][0]
	if c == 'R':
		return 'P' * n
	elif c == 'P':
		return 'S' * n
	else:
		return 'R' * n

def main():
	t = int(input())
	for _ in range(t):
		S = input()
		result = fast(S)
		print(result)
main()


from collections import Counter

def main():
	for _ in range(int(input())):
		s = list(input())
		d = dict(Counter(s))
		s1 = list(set(s))
		d1 = {'R': 'P', 'P': 'S', 'S': 'R'}
		print(d1[max([[d[s1[i]], s1[i]] for i in range(len(s1))])[1]] * len(s))
main()


for _ in range(int(input())):
	s = input()
	n = len(s)
	rct = s.count('R')
	pct = s.count('P')
	sct = s.count('S')
	mx = max(rct, pct, sct)
	if rct == mx:
		print('P' * n)
	elif pct == mx:
		print('S' * n)
	else:
		print('R' * n)


from collections import Counter
cases = int(input())
for t in range(cases):
	s = input()
	s = Counter(s)
	mv = max(list(s.values()))
	c = ''
	for i in s:
		if s[i] == mv:
			c = i
	d = {'S': 'R', 'R': 'P', 'P': 'S'}
	c1 = d[c]
	v = sum(list(s.values()))
	print(c1 * v)


import sys
import math
from math import factorial, inf, gcd
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
sys.setrecursionlimit(10 ** 5)
t = int(input())
for ii in range(t):
	s = input()
	c = Counter(s)
	a = list(c.keys())[0]
	for (i, j) in c.items():
		if j > c[a]:
			a = i
	ans = 'P' if a == 'R' else 'R' if a == 'S' else 'S'
	print(ans * len(s))


t = int(input())

def rec(mn, ind, l, b):
	if ind == 0:
		return 0
	elif mn[ind - 1][0] < l and mn[ind - 1][1] < b:
		return max(rec(mn, ind - 1, l, b), mn[ind - 1][2] + rec(mn, ind - 1, mn[ind - 1][0], mn[ind - 1][1]))
	else:
		return rec(mn, ind - 1, l, b)
for _ in range(t):
	n = input()
	p = 0
	s = 0
	r = 0
	for i in n:
		if i == 'P':
			p += 1
		elif i == 'S':
			s += 1
		else:
			r += 1
	ans = ''
	if max(p, s, r) == p:
		for i in range(len(n)):
			ans += 'S'
	elif max(p, s, r) == s:
		for i in range(len(n)):
			ans += 'R'
	else:
		for i in range(len(n)):
			ans += 'P'
	print(ans)


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def main():
	tt = sint()
	while tt:
		tt -= 1
		s = input()
		cnt = {'P': 0, 'R': 0, 'S': 0}
		for i in s:
			if i == 'R':
				cnt['P'] += 1
			elif i == 'S':
				cnt['R'] += 1
			else:
				cnt['S'] += 1
		ans = ''
		(r, p, ss) = (cnt['R'], cnt['P'], cnt['S'])
		if r >= p and r >= ss:
			ans = 'R'
		elif p >= r and p >= ss:
			ans = 'P'
		else:
			ans = 'S'
		print(ans * len(s))
main()


for _ in range(int(input())):
	s = input()
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	ans = ''
	count = {}
	for i in s:
		count[i] = count.get(i, 0) + 1
	maxChar = -1
	charac = ''
	for char in count.keys():
		if count[char] > maxChar:
			maxChar = count[char]
			charac = char
	print(d[charac] * len(s))


def multiple_input():
	return map(int, input().split())

def list_input():
	return list(map(int, input().split()))
for _ in range(int(input())):
	x = input()
	(r, s, p) = (0, 0, 0)
	for i in x:
		if i == 'R':
			r += 1
		elif i == 'S':
			s += 1
		else:
			p += 1
	if r == s == p:
		ans = x
	elif r == s and r > p:
		c = len(x) // 2
		ans = c * 'P' + c * 'R'
		if len(x) % 2 != 0:
			ans += 'R'
	elif s == p and s > r:
		c = len(x) // 2
		ans = c * 'R' + c * 'S'
		if len(x) % 2 != 0:
			ans += 'S'
	elif r == p and r > s:
		c = len(x) // 2
		ans = c * 'P' + c * 'S'
		if len(x) % 2 != 0:
			ans += 'S'
	elif r > s and r > p:
		ans = len(x) * 'P'
	elif s > r and s > p:
		ans = len(x) * 'R'
	elif p > s and p > r:
		ans = len(x) * 'S'
	print(ans)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	s = input().strip()
	n = len(s)
	(x, y, z) = (s.count('R'), s.count('S'), s.count('P'))
	k = max(x, y, z)
	if x == k:
		ans = ['P' for _ in range(n)]
	elif y == k:
		ans = ['R' for _ in range(n)]
	elif z == k:
		ans = ['S' for _ in range(n)]
	print(''.join(ans))


for _ in range(int(input())):
	s1 = input()
	n = len(s1)
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	(r, s, p) = (s1.count('R'), s1.count('S'), s1.count('P'))
	if r >= s and r >= p:
		res = d['R'] * n
	elif s >= r and s >= p:
		res = d['S'] * n
	elif p >= r and p >= s:
		res = d['P'] * n
	print(res)


class Solution:

	def __init__(self):
		for t in range(int(input())):
			s = list(input())
			self.solve(s)

	def solve(self, s):
		win = {'R': 'P', 'P': 'S', 'S': 'R'}
		best = list(map(lambda x: (sum([1 for i in s if i == x]), win[x]), win.keys()))
		print(max(best)[1] * len(s))
Solution()


import math

def sumofno(n):
	summ = 0
	while n > 0:
		summ += n % 10
		n //= 10
	return summ

def get_key(val, lis):
	for (key, value) in lis.items():
		if value == val:
			return key
try:
	t = int(input())
	ans = []
	for i in range(t):
		a = list(input())
		r = a.count('R')
		s = a.count('S')
		p = a.count('P')
		maxx = max(r, s, p)
		if r == maxx:
			maxxi = 'P'
		if s == maxx:
			maxxi = 'R'
		if p == maxx:
			maxxi = 'S'
		ans.append(maxxi * len(a))
	for an in ans:
		print(an)
except:
	pass


from sys import stdin
TT = int(stdin.readline())
alp = 'RPS'
dic = {}
dic['R'] = 0
dic['P'] = 1
dic['S'] = 2
for loop in range(TT):
	s = stdin.readline()[:-1]
	lis = [0, 0, 0]
	for i in s:
		lis[dic[i]] += 1
	maxind = 0
	for i in range(3):
		if lis[i] > lis[maxind]:
			maxind = i
	print(alp[(maxind + 1) % 3] * len(s))


for i in range(int(input())):
	a = input()
	(x, y, z) = (a.count('R'), a.count('P'), a.count('S'))
	if max(z, y, x) == x:
		print('P' * len(a))
	elif max(z, y, x) == z:
		print('R' * len(a))
	elif max(z, y, x) == y:
		print('S' * len(a))


import math
for _ in range(int(input())):
	st = input()
	p = 0
	r = 0
	s = 0
	for i in st:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
	m = max(r, s, p)
	c = ''
	if m == r:
		c = 'P'
	elif m == s:
		c = 'R'
	else:
		c = 'S'
	print(c * len(st))


t = int(input())
for _ in range(t):
	a = input()
	r = a.count('R')
	p = a.count('P')
	s = a.count('S')
	if r >= p and r >= s:
		print('P' * len(a))
	elif p >= r and p >= s:
		print('S' * len(a))
	elif s >= p and s >= r:
		print('R' * len(a))


t = int(input())
l = 'RSP'
r = 'PRS'

def solve():
	s = input()
	cnt = [0] * 3
	for c in s:
		for j in range(3):
			if l[j] == c:
				cnt[j] += 1
	print(r[cnt.index(max(cnt))] * len(s))
for test in range(t):
	solve()


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
from collections import Counter
for case in range(itg()):
	s = inp()
	most = Counter(s).most_common(1)[0][0]
	if most == 'R':
		print('P' * len(s))
	elif most == 'P':
		print('S' * len(s))
	elif most == 'S':
		print('R' * len(s))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	s = stdin.readline().strip()
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	dct = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		dct[d[i]] += 1
	x = max(dct, key=dct.get)
	stdout.write(''.join([x] * len(s)))
	stdout.write('\n')


for _ in range(int(input())):
	str1 = input()
	list1 = list(str1)
	countR = 0
	countP = 0
	countS = 0
	for i in range(len(list1)):
		if list1[i] == 'R':
			countR += 1
		elif list1[i] == 'P':
			countP += 1
		elif list1[i] == 'S':
			countS += 1
	newList = [countR, countP, countS]
	index = newList.index(max(newList))
	if index == 0:
		print('P' * len(list1))
	elif index == 1:
		print('S' * len(list1))
	elif index == 2:
		print('R' * len(list1))


t = int(input())
for hatt in range(t):
	s = input()
	(nr, np, ns) = (0, 0, 0)
	for i in s:
		if i == 'R':
			nr += 1
		elif i == 'S':
			ns += 1
		else:
			np += 1
	m = max(nr, np, ns)
	if m == nr:
		c = 'P'
	elif m == ns:
		c = 'R'
	else:
		c = 'S'
	print(c * len(s))


from collections import Counter
for cn in range(1, int(input()) + 1):
	s = input()
	c = Counter(s)
	cr = c['R']
	cp = c['P']
	cs = c['S']
	if cr >= max(cp, cs):
		ans = 'P'
	elif cp >= max(cr, cs):
		ans = 'S'
	else:
		ans = 'R'
	print(''.join([ans] * len(s)))


for i in range(int(input())):
	di = dict()
	n = input()
	for i in n:
		di[i] = di.get(i, 0) + 1
	b = max(di.values())
	if len(di) == 1:
		for (i, j) in di.items():
			if i == 'R':
				x = ['P'] * j
				print(*x, sep='')
			elif i == 'S':
				x = ['R'] * j
				print(*x, sep='')
			elif i == 'P':
				x = ['S'] * j
				print(*x, sep='')
	else:
		for (i, j) in di.items():
			if j == b:
				if i == 'R':
					x = ['P'] * len(n)
					print(*x, sep='')
					break
				elif i == 'S':
					x = ['R'] * len(n)
					print(*x, sep='')
					break
				elif i == 'P':
					x = ['S'] * len(n)
					print(*x, sep='')
					break
			else:
				continue


t = int(input())
for i in range(t):
	s = list(input())
	a = s.count('R')
	b = s.count('P')
	c = s.count('S')
	if a >= b and a >= c:
		print('P' * len(s))
	elif b >= a and b >= c:
		print('S' * len(s))
	else:
		print('R' * len(s))


def get_beating(x):
	if x == 'R':
		return 'P'
	elif x == 'P':
		return 'S'
	else:
		return 'R'
for _ in range(int(input())):
	play = input()
	output = ''
	R = play.count('R')
	S = play.count('S')
	P = play.count('P')
	if R >= S and R >= P:
		print(len(play) * get_beating('R'))
	elif S >= R and S >= P:
		print(len(play) * get_beating('S'))
	else:
		print(len(play) * get_beating('P'))


t = int(input())
for test in range(t):
	s = input()
	first = s.count('R')
	second = s.count('P')
	third = len(s) - first - second
	if first >= second and first >= third:
		print('P' * len(s))
	elif second >= first and second >= third:
		print('S' * len(s))
	else:
		print('R' * len(s))


for _ in range(int(input())):
	l = list(input())
	r = l.count('R')
	s = l.count('S')
	p = l.count('P')
	m = max(r, s, p)
	if r == m:
		for i in range(len(l)):
			print('P', end='')
		print()
	elif s == m:
		for i in range(len(l)):
			print('R', end='')
		print()
	else:
		for i in range(len(l)):
			print('S', end='')
		print()


t = int(input())
for i in range(t):
	a = input()
	n = len(a)
	k1 = 0
	k2 = 0
	k3 = 0
	for i in range(n):
		if a[i] == 'R':
			k1 += 1
		elif a[i] == 'P':
			k2 += 1
		else:
			k3 += 1
	if k1 >= k2 and k1 >= k3:
		print('P' * n)
	elif k2 >= k3 and k2 >= k1:
		print('S' * n)
	else:
		print('R' * n)


t = int(input().split()[0])
for case in range(t):
	s = input().split()[0]
	(r, p, sc) = (0, 0, 0)
	ans = ''
	for l in s:
		if l == 'R':
			r += 1
		elif l == 'P':
			p += 1
		else:
			sc += 1
	if sc >= r and sc >= p:
		ans = 'R' * len(s)
	elif p >= sc and p >= r:
		ans = 'S' * len(s)
	else:
		ans = 'P' * len(s)
	print(ans)


t = int(input())
for i in range(0, t):
	string = input()
	(R, P, S) = (string.count('R'), string.count('P'), string.count('S'))
	if max(R, S, P) == R:
		print('P' * len(string))
	elif max(R, S, P) == P:
		print('S' * len(string))
	else:
		print('R' * len(string))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	s = data()
	n = len(s)
	c = C(s)
	(m, char) = (-1, 'x')
	for i in c.keys():
		if c[i] > m:
			char = i
			m = c[i]
	if char == 'R':
		out('P' * n)
		continue
	if char == 'P':
		out('S' * n)
		continue
	out('R' * n)


def solve(s1):
	sign = [0, 0, 0]
	for c in s1:
		if c == 'R':
			sign[0] += 1
		elif c == 'S':
			sign[1] += 1
		elif c == 'P':
			sign[2] += 1
	highest_count = sign.index(max(sign))
	ret = None
	if highest_count == 0:
		ret = 'P'
	elif highest_count == 1:
		ret = 'R'
	else:
		ret = 'S'
	for i in range(len(s1)):
		print(ret, end='')
	print()
	return
T = int(input())
for t in range(T):
	s = input()
	solve(s)


for _ in range(int(input())):
	l = list(input())
	d = {'R': 0, 'S': 0, 'P': 0}
	for i in l:
		d[i] += 1
	mw = None
	n = None
	for i in d:
		if n is None or n < d[i]:
			n = d[i]
			mw = i
	op = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(op[mw] * len(l))


T = int(input())
for case in range(T):
	value = input()
	count = [0, 0, 0]
	for v in value:
		if v == 'R':
			count[0] += 1
		elif v == 'S':
			count[1] += 1
		elif v == 'P':
			count[2] += 1
	if count[0] >= count[1] and count[0] >= count[2]:
		print('P' * len(value))
	elif count[1] >= count[0] and count[1] >= count[2]:
		print('R' * len(value))
	else:
		print('S' * len(value))


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	count = Counter(s)
	convert = {'R': 'P', 'P': 'S', 'S': 'R'}
	result = []
	maxCount = max(count.values())
	chars = []
	for c in count:
		if count[c] == maxCount:
			chars.append(c)
			for _ in range(maxCount):
				result.append(convert[c])
	while len(result) < len(s):
		result.append(convert[chars[0]])
	print(''.join(result))


for _ in range(int(input())):
	d = {'R': 0, 'P': 0, 'S': 0}
	for i in input():
		d[i] += 1
	t = max(d.values())
	l = sum(d.values())
	if d['R'] == t:
		print('P' * l)
	elif d['P'] == t:
		print('S' * l)
	else:
		print('R' * l)


for _ in range(int(input())):
	s = input()
	n = len(s)
	r = s.count('R')
	p = s.count('P')
	si = s.count('S')
	m = max(r, p, si)
	if r == m:
		print('P' * n)
	elif p == m:
		print('S' * n)
	else:
		print('R' * n)


n = int(input())
for _ in range(n):
	a = input()
	r = a.count('R')
	s = a.count('S')
	p = a.count('P')
	n = max(r, s, p)
	if n == r:
		k = 'P'
	elif n == s:
		k = 'R'
	elif n == p:
		k = 'S'
	answer = ''
	for i in range(len(a)):
		answer += k
	print(answer)


from sys import stdout, stdin
from collections import Counter
input = stdin.readline

def solve():
	a = input().strip()
	n = len(a)
	c = Counter()
	for i in range(n):
		c[a[i]] += 1
	if c['R'] == c['S'] == c['P']:
		stdout.write(a + '\n')
	else:
		b = ''
		m = max(c['R'], c['S'], c['P'])
		if m == c['R']:
			b = 'P' * n
		elif m == c['P']:
			b = 'S' * n
		else:
			b = 'R' * n
		stdout.write(b + '\n')

def main():
	for t in range(int(input())):
		solve()
main()


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		s = rs()
		(ns, nr, np) = (0, 0, 0)
		for i in s:
			if i == 'R':
				nr += 1
			if i == 'S':
				ns += 1
			if i == 'P':
				np += 1
		z = [ns, nr, np]
		c = max(z)
		for i in z:
			if i == ns and i == c:
				print('R' * len(s))
				break
			if i == np and i == c:
				print('S' * len(s))
				break
			if i == nr and i == c:
				print('P' * len(s))
				break
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


from collections import Counter
opp = {'S': 'R', 'R': 'P', 'P': 'S'}
for i in range(int(input())):
	s = input()
	d = Counter(s)
	print(opp[d.most_common(1)[0][0]] * len(s))


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		s = sin()
		d = {'R': 0, 'S': 0, 'P': 0}
		x = {'R': 'P', 'S': 'R', 'P': 'S'}
		for i in s:
			d[i] += 1
		maxi = max(d.values())
		for i in d.keys():
			if d[i] == maxi:
				print(x[i] * len(s))
				break
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def solve(t):
	r = t.count('R')
	s = t.count('S')
	p = t.count('P')
	if r >= max(s, p):
		return 'P' * len(t)
	elif s >= max(r, p):
		return 'R' * len(t)
	else:
		return 'S' * len(t)
T = int(input())
for _ in range(T):
	print(solve(input()))


t = int(input())
for _ in range(t):
	s = input()
	(R, S, P) = (0, 0, 0)
	for i in s:
		if i == 'R':
			R += 1
		elif i == 'S':
			S += 1
		elif i == 'P':
			P += 1
	mV = max(R, S, P)
	if R == mV:
		print('P' * len(s))
	elif S == mV:
		print('R' * len(s))
	else:
		print('S' * len(s))


def solve():
	s = input()
	ans = ''
	op = {'R': 'P', 'S': 'R', 'P': 'S'}
	counter = {}
	mx = s[0]
	mxc = 1
	for c in s:
		counter.setdefault(c, 0)
		counter[c] += 1
		if counter[c] > mxc:
			mxc = counter[c]
			mx = c
	ans = op[mx] * len(s)
	print(ans)
t = int(input())
for _ in range(t):
	solve()


import collections
t = int(input())
for _ in range(t):
	s = input()
	ans = {'S': 'R', 'P': 'S', 'R': 'P'}
	freq = collections.Counter(s).most_common(1)[0][0]
	print(ans[freq] * len(s))


T = int(input())
moves = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(T):
	m = input()
	ans = ''
	r_count = m.count('R')
	p_count = m.count('P')
	s_count = m.count('S')
	ls = [r_count, p_count, s_count]
	mx = ls.index(max(ls))
	if mx == 0:
		ans += 'P' * len(m)
	if mx == 1:
		ans += 'S' * len(m)
	if mx == 2:
		ans += 'R' * len(m)
	print(ans)


for t in range(int(input())):
	s = input()
	a = ''
	j = 0
	num = [0, 0, 0]
	for i in range(len(s)):
		if s[i] == 'R':
			num[2] += 1
			if num[2] > num[j]:
				j = 2
				a = 'P'
		elif s[i] == 'S':
			if num[0] + 1 > num[j]:
				j = 0
				a = 'R'
			num[0] += 1
		elif s[i] == 'P':
			num[1] += 1
			if num[1] > num[j]:
				j = 1
				a = 'S'
	print(a * len(s))


from collections import Counter
d = {'R': 'P', 'P': 'S', 'S': 'R'}
n = int(input().strip())
for i in range(n):
	s = input().strip()
	count = dict(Counter(list(s)))
	c = max(count, key=lambda x: count[x])
	print(d[c] * len(s))


import bisect
import sys
import math
input = sys.stdin.readline
import functools
from collections import Counter
from collections import defaultdict

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(case):
	s = input().rstrip()
	n = len(s)
	c = Counter(s)
	v = c.most_common(1)[0][0]
	if v == 'R':
		return 'P' * n
	elif v == 'S':
		return 'R' * n
	elif v == 'P':
		return 'S' * n
if len(sys.argv) > 1 and sys.argv[1].startswith('input'):
	f = open('./' + sys.argv[1], 'r')
	input = f.readline
T = inp()
for i in range(T):
	res = solve(i + 1)
	print(str(res))


for _ in range(int(input())):
	s = input()
	i = max(s.count('R'), max(s.count('S'), s.count('P')))
	if i == s.count('R'):
		print('P' * len(s))
	elif i == s.count('P'):
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
while t:
	t -= 1
	s = input()
	rock = s.count('R')
	paper = s.count('P')
	scissors = s.count('S')
	m = max(rock, paper, scissors)
	if m == rock:
		print('P' * len(s))
	elif m == paper:
		print('S' * len(s))
	else:
		print('R' * len(s))


for _ in range(int(input())):
	s = input()
	d = dict()
	d['R'] = 0
	d['S'] = 0
	d['P'] = 0
	d1 = dict()
	d1['R'] = 'P'
	d1['S'] = 'R'
	d1['P'] = 'S'
	for i in s:
		d[i] += 1
	ans = ''
	c = ''
	mx = -1
	for i in list(d.items()):
		if mx < i[1]:
			c = d1[i[0]]
			mx = i[1]
	print(c * len(s))


t = int(input())
for _ in range(t):
	sa = input()
	(r, p, s) = (0, 0, 0)
	for a in range(len(sa)):
		if sa[a] == 'R':
			r += 1
		elif sa[a] == 'P':
			p += 1
		else:
			s += 1
	if max(r, p, s) == r:
		print('P' * len(sa))
	elif max(r, p, s) == p:
		print('S' * len(sa))
	else:
		print('R' * len(sa))


t = int(input())
while t > 0:
	t -= 1
	a = input()
	a = list(a)
	l = len(a)
	r = 0
	s = 0
	p = 0
	ans = ''
	for i in a:
		if i == 'R':
			r += 1
		if i == 'S':
			s += 1
		if i == 'P':
			p += 1
	m = max(r, s, p)
	if m == r:
		i = 0
		while i < l:
			ans += 'P'
			i += 1
		print(ans)
		continue
	if m == s:
		i = 0
		while i < l:
			ans += 'R'
			i += 1
		print(ans)
		continue
	if m == p:
		i = 0
		while i < l:
			ans += 'S'
			i += 1
		print(ans)
		continue


def universalsol(s):
	rock = s.count('R')
	paper = s.count('P')
	scissor = s.count('S')
	if rock == paper == scissor:
		print('R' * scissor + 'P' * rock + 'S' * paper)
	else:
		maximum = max(rock, paper, scissor)
		if rock == maximum:
			print('P' * len(s))
		elif paper == maximum:
			print('S' * len(s))
		else:
			print('R' * len(s))
t = int(input())
for i in range(t):
	s = input().strip()
	universalsol(s)


from math import *
z = int(input())
for q in range(z):
	s = input()
	c = ''
	a = [0] * 3
	for i in s:
		if i == 'R':
			a[0] += 1
		if i == 'P':
			a[1] += 1
		if i == 'S':
			a[2] += 1
	m = 'R'
	r = a[0]
	if a[1] > r:
		m = 'P'
		r = a[1]
	if a[2] > r:
		m = 'S'
		r = a[2]
	if a[0] == a[1] and a[0] == a[2]:
		for i in range(len(s)):
			if s[i] == 'R':
				c += 'P'
			if s[i] == 'P':
				c += 'S'
			if s[i] == 'S':
				c += 'R'
	else:
		if m == 'R':
			c += len(s) * 'P'
		if m == 'P':
			c += len(s) * 'S'
		if m == 'S':
			c += len(s) * 'R'
	print(c)


import os
os_input = os.read(0, int(10000000.0)).split()
os_input_pos = -1
answer_list = []

def read_s():
	global os_input_pos
	os_input_pos += 1
	return os_input[os_input_pos].decode()

def read_i():
	return int(read_s())

def write_s(v):
	answer_list.append(v)

def write_i(v):
	write_s(str(v))

def print_ans():
	os.write(1, '\n'.join(answer_list).encode())
	os.write(1, '\n'.encode())
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
			else:
				stack.pop()
				if not stack:
					break
				to = stack[-1].send(to)
		return to
	return wrapped_func
from itertools import groupby
T = read_i()
while T:
	T -= 1
	s = read_s()
	(_, val) = max([(len(list(g)), k) for (k, g) in groupby(sorted(s))])
	if val == 'R':
		write_s('P' * len(s))
	elif val == 'S':
		write_s('R' * len(s))
	else:
		write_s('S' * len(s))
print_ans()


a = int(input())
for i in range(a):
	x = input()
	x1 = x.count('R')
	x2 = x.count('P')
	x3 = len(x) - x1 - x2
	if x3 == max(x1, x2, x3):
		print('R' * len(x))
	elif x2 == max(x1, x2, x3):
		print('S' * len(x))
	else:
		print('P' * len(x))


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	st = input()
	ans = ''
	r = st.count('S')
	s = st.count('P')
	p = st.count('R')
	l = [[r, 1], [s, 2], [p, 3]]
	l.sort()
	if l[-1][1] == 3:
		ans += 'P' * (len(st) - 1)
	if l[-1][1] == 2:
		ans += 'S' * (len(st) - 1)
	if l[-1][1] == 1:
		ans += 'R' * (len(st) - 1)
	print(ans)


def ans(z):
	(r, p, s) = (z.count('R'), z.count('P'), z.count('S'))
	if r >= max(p, s):
		return 'P' * len(z)
	if p >= max(r, s):
		return 'S' * len(z)
	if s >= max(p, r):
		return 'R' * len(z)
for i in range(int(input())):
	print(ans(input()))


t = int(input())
for _ in range(t):
	s = input()
	S_count = s.count('S')
	R_count = s.count('R')
	P_count = s.count('P')
	Max_count = max(S_count, R_count, P_count)
	if S_count == Max_count:
		print('R' * len(s))
	elif P_count == Max_count:
		print('S' * len(s))
	elif R_count == Max_count:
		print('P' * len(s))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	ip = stdin.readline().rstrip()
	n = len(ip)
	r = ip.count('R')
	p = ip.count('P')
	s = ip.count('S')
	maxC = max(r, p, s)
	if r == maxC:
		print('P' * n)
	elif p == maxC:
		print('S' * n)
	else:
		print('R' * n)


def kamane(s):
	counter = {'R': 0, 'P': 0, 'S': 0}
	for c in s:
		counter[c] += 1
	if counter['R'] >= counter['S'] and counter['R'] >= counter['P']:
		return 'P' * len(s)
	if counter['P'] >= counter['R'] and counter['P'] >= counter['S']:
		return 'S' * len(s)
	if counter['S'] >= counter['R'] and counter['S'] >= counter['P']:
		return 'R' * len(s)
t = int(input())
for i in range(t):
	print(kamane(input()))


import math
import sys
input = sys.stdin.readline
t = int(input())
for cs in range(t):
	s = input().strip()
	d = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		d[i] = d[i] + 1
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	(cnt, opt) = max([(value, key) for (key, value) in d.items()])
	print(win[opt] * len(s))


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	S = input()
	N = len(S)
	rcnt = S.count('R')
	scnt = S.count('S')
	pcnt = S.count('P')
	mx = max(rcnt, scnt, pcnt)
	if mx == rcnt:
		ans = 'P' * N
	elif mx == scnt:
		ans = 'R' * N
	else:
		ans = 'S' * N
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	rcount = 0
	pcount = 0
	scount = 0
	for i in range(len(s)):
		if s[i] == 'R':
			rcount += 1
		if s[i] == 'S':
			scount += 1
		if s[i] == 'P':
			pcount += 1
	ans = []
	if rcount >= pcount and rcount >= scount:
		for i in range(len(s)):
			ans.append('P')
	elif scount >= pcount and scount >= rcount:
		for i in range(len(s)):
			ans.append('R')
	else:
		for i in range(len(s)):
			ans.append('S')
	print(''.join(ans))


r = 'R'
p = 'P'
s = 'S'
c = [r, p, s]
for _ in range(int(input())):
	n = input()
	a = {r: 0, p: 0, s: 0}
	for v in n:
		a[v] += 1
	best = 0
	bc = r
	for (k, v) in a.items():
		if v > best:
			best = v
			bc = k
	print(c[(c.index(bc) + 1) % 3] * len(n))


t = int(input())
for i in range(t):
	s = input()
	numr = s.count('R')
	nums = s.count('S')
	nump = s.count('P')
	if numr >= nums:
		if numr >= nump:
			print('P' * len(s))
		else:
			print('S' * len(s))
	elif nums >= nump:
		print('R' * len(s))
	else:
		print('S' * len(s))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	robot = [k for k in input()]
	dict1 = {'R': 0, 'S': 0, 'P': 0}
	for s in range(len(robot)):
		if robot[s] == 'R':
			dict1['R'] += 1
		elif robot[s] == 'S':
			dict1['S'] += 1
		else:
			dict1['P'] += 1
	highest = 0
	letter = 'R'
	for s in dict1.keys():
		if dict1[s] > highest:
			highest = dict1[s]
			letter = s
	counter = 'R'
	if letter == 'R':
		counter = 'P'
	if letter == 'P':
		counter = 'S'
	if letter == 'S':
		counter = 'R'
	outy = [counter for s in range(len(robot))]
	print(''.join(outy))


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // GCD(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	s = list(stin())
	n = []
	r = s.count('R')
	p = s.count('P')
	sc = s.count('S')
	mx = max([r, p, sc])
	if mx == r:
		print(''.join(['P'] * len(s)))
	elif mx == p:
		print(''.join(['S'] * len(s)))
	elif mx == sc:
		print(''.join(['R'] * len(s)))


for _ in range(int(input())):
	n = input()
	(r, p, s) = (0, 0, 0)
	for i in n:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
	if r >= p and r >= s:
		print('P' * len(n))
	elif p >= r and p >= s:
		print('S' * len(n))
	else:
		print('R' * len(n))


for t in range(int(input())):
	a = list(input())
	n = len(a)
	r = a.count('R')
	s = a.count('S')
	p = a.count('P')
	m = max(r, s, p)
	if m == r:
		print('P' * n)
	elif m == p:
		print('S' * n)
	elif m == s:
		print('R' * n)


def mi():
	return map(int, input().split())

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def si():
	return input().split()
t = ii()
ans = ['PPP', 'PPR', 'PPS', 'PRP', 'PRR', 'PRS', 'PSP', 'PSR', 'PSS', 'RPP', 'RPR', 'RPS', 'RRP', 'RRR', 'RRS', 'RSP', 'RSR', 'RSS', 'SPP', 'SPR', 'SPS', 'SRP', 'SRR', 'SRS', 'SSP', 'SSR', 'SSS']
for _ in range(t):
	s = input()
	(r, p, c) = (0, 0, 0)
	for i in s:
		if i == 'S':
			c += 1
		if i == 'P':
			p += 1
		if i == 'R':
			r += 1
	ma = max(r, c, p)
	if ma == r and ma == c and (ma == p):
		print('PRS' * ma)
	elif r == ma:
		print('P' * len(s))
	elif c == ma:
		print('R' * len(s))
	else:
		print('S' * len(s))


for _ in range(int(input())):
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	ans = ''
	s = input()
	d1 = {'P': s.count('P'), 'R': s.count('R'), 'S': s.count('S')}
	max1 = 0
	q1 = ''
	for (q, v) in d1.items():
		if v > max1:
			max1 = v
			q1 = q
	print(d[q1] * len(s))


from collections import Counter
steps = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	bot_step = input()
	freq_step = max(Counter(bot_step).items(), key=lambda i: i[1])[0]
	print(steps[freq_step] * len(bot_step))


import math
for _ in range(int(input())):
	x = input()
	s = x.count('S')
	r = x.count('R')
	p = x.count('P')
	if s == max(s, r, p):
		print('R' * len(x))
	elif r == max(s, r, p):
		print('P' * len(x))
	else:
		print('S' * len(x))


for _ in range(int(input())):
	sT = input()
	dic = {'R': 'P', 'P': 'S', 'S': 'R'}
	(r, p, s) = (sT.count('R'), sT.count('P'), sT.count('S'))
	c = ''
	if r >= p and r >= s:
		c = 'P' * len(sT)
	elif r <= p and p >= s:
		c = 'S' * len(sT)
	elif s >= p and r <= s:
		c = 'R' * len(sT)
	print(c)


from collections import Counter
for i in range(int(input())):
	s = input()
	cnt = Counter(s)
	arr = sorted(list(cnt.items()), key=lambda i: i[1])
	if arr[-1][0] == 'R':
		print('P' * len(s))
		continue
	elif arr[-1][0] == 'P':
		print('S' * len(s))
		continue
	else:
		print('R' * len(s))


import sys
import math
import bisect
from sys import stdin
from itertools import groupby
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
for _ in range(int(input())):
	S = input()
	n = len(S)
	r = S.count('R')
	s = S.count('S')
	p = S.count('P')
	if r == max(s, r, p):
		print(n * 'P')
	elif s == max(s, r, p):
		print(n * 'R')
	else:
		print(n * 'S')


def main(s):
	hash = {}
	flip = {'S': 'R', 'R': 'P', 'P': 'S'}
	for i in s:
		if i not in hash:
			hash[i] = 1
		else:
			hash[i] += 1
	char = ''
	c = 0
	for i in hash:
		if hash[i] > c:
			c = hash[i]
			char = i
	print(flip[char] * len(s))
n = int(input())
for i in range(n):
	s = input()
	main(s)


from collections import Counter
win = {'R': 'P', 'P': 'S', 'S': 'R'}
t = int(input())
for tc in range(t):
	s = input()
	c = Counter(s).most_common(1)[0]
	n = len(s)
	print(win[c[0]] * n)


a = int(input())
for x in range(a):
	b = input()
	n = len(b)
	j = []
	j.append(b.count('P'))
	j.append(b.count('R'))
	j.append(b.count('S'))
	l = j.index(max(j))
	if l == 0:
		for x in range(n):
			if x == n - 1:
				print('S')
			else:
				print('S', end='')
	elif l == 1:
		for x in range(n):
			if x == n - 1:
				print('P')
			else:
				print('P', end='')
	else:
		for x in range(n):
			if x == n - 1:
				print('R')
			else:
				print('R', end='')


import math
import bisect
import copy
import time
from collections import Counter
for _ in range(int(input())):
	x = list(input())
	d = Counter(x)
	ma = 0
	ans = 0
	for (u, v) in d.items():
		if v > ma:
			ans = u
			ma = v
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(d[ans] * len(x))


import sys
input = sys.stdin.readline
from operator import itemgetter
Q = int(input())
for _ in range(Q):
	S = input().rstrip()
	dic = {'R': 0, 'S': 0, 'P': 0}
	for s in S:
		dic[s] += 1
	P = sorted(list(dic.items()), key=itemgetter(1))
	W = P[-1][0]
	if W == 'R':
		E = 'P'
	elif W == 'S':
		E = 'R'
	else:
		E = 'S'
	print(E * len(S))


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	cntr = Counter(s)
	mc = cntr.most_common(1)[0][0]
	if mc == 'R':
		w = 'P'
	elif mc == 'P':
		w = 'S'
	else:
		w = 'R'
	print(w * n)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
for _ in range(II()):
	s = SI()
	hand = 'RSP'
	cnt = [0] * 3
	for c in s:
		i = hand.find(c)
		cnt[i] += 1
	mx = max(cnt)
	for i in range(3):
		if cnt[i] == mx:
			print(hand[i - 1] * len(s))
			break


for _ in range(int(input())):
	s = list(input())
	h = {'P': 0, 'S': 0, 'R': 0}
	for i in s:
		h[i] += 1
	mi = 0
	key = ''
	for i in h.keys():
		if h[i] > mi:
			mi = h[i]
			key = i
	if h['P'] == 1 and h['S'] == 1 and (h['R'] == 1):
		print('PSR')
	elif key == 'P':
		print('S' * len(s))
	elif key == 'R':
		print('P' * len(s))
	else:
		print('R' * len(s))


T = int(input())
for _ in range(T):
	arr = input().strip()
	n = len(arr)
	(R, P, S) = (0, 0, 0)
	for ch in arr:
		if ch == 'R':
			R += 1
		elif ch == 'P':
			P += 1
		else:
			S += 1
	maxc = max(max(R, P), S)
	ans = ''
	if R == maxc:
		for i in range(n):
			ans += 'P'
	elif P == maxc:
		for i in range(n):
			ans += 'S'
	else:
		for i in range(n):
			ans += 'R'
	print(ans)


from collections import Counter

def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	text = input().strip()
	(R, S, P) = (0, 0, 0)
	for c in text:
		if c == 'P':
			P += 1
		elif c == 'R':
			R += 1
		else:
			S += 1
	return ''.join(max((R, 'P'), (S, 'R'), (P, 'S'))[1] * len(text))
T = read_int()
for _ in range(T):
	print(solve())


t = int(input())
while t > 0:
	t = t - 1
	a = input()
	q = len(a)
	r = 0
	p = 0
	s = 0
	for i in range(0, q):
		if a[i] == 'R':
			r = r + 1
		if a[i] == 'P':
			p = p + 1
		if a[i] == 'S':
			s = s + 1
	c = 0
	if max(r, p, s) == r:
		c = 'P'
	if max(r, p, s) == p:
		c = 'S'
	if max(r, p, s) == s:
		c = 'R'
	c = c * q
	print(c)


t = int(input())
while t:
	s = input()
	answ = ''
	(count_r, count_s, count_p) = (0, 0, 0)
	for i in s:
		if i == 'R':
			count_r += 1
		elif i == 'P':
			count_p += 1
		elif i == 'S':
			count_s += 1
	max_count = max(count_r, count_s, count_p)
	if max_count == count_r:
		answ = 'P' * len(s)
	elif max_count == count_p:
		answ = 'S' * len(s)
	elif max_count == count_s:
		answ = 'R' * len(s)
	print(answ)
	t -= 1


tests = int(input())
for _ in range(tests):
	s = input()
	n = len(s)
	cnt = {'R': 0, 'P': 0, 'S': 0}
	for c in s:
		cnt[c] += 1
	target = max(cnt.values())
	ans = 'R'
	for (u, v) in cnt.items():
		if v == target:
			if u == 'R':
				ans = 'P'
			if u == 'P':
				ans = 'S'
			break
	print(ans * n)


for _ in range(int(input())):
	n = input()
	scount = n.count('S')
	pcount = n.count('P')
	rcount = n.count('R')
	if scount == max(scount, pcount, rcount):
		print(len(n) * 'R')
	elif pcount == max(scount, rcount, pcount):
		print(len(n) * 'S')
	else:
		print(len(n) * 'P')


import math

def main():
	string = str(input())
	res = ''
	cntr = 0
	cnts = 0
	cntp = 0
	for i in string:
		if i == 'R':
			cntr += 1
		elif i == 'P':
			cntp += 1
		elif i == 'S':
			cnts += 1
	if cntr >= cnts and cntr >= cntp:
		res = 'P' * len(string)
	elif cntp >= cntr and cntp >= cnts:
		res = 'S' * len(string)
	else:
		res = 'R' * len(string)
	print(res)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


keys = {'R': 'P', 'S': 'R', 'P': 'S'}
for test in range(int(input())):
	s = input()
	counter = {s.count('R'): 'R', s.count('S'): 'S', s.count('P'): 'P'}
	m = max(counter.keys())
	ans = keys[counter[m]] * len(s)
	print(ans)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		s = str(input())
		n = len(s)
		rsp = [0, 0, 0]
		for x in s:
			if x == 'R':
				rsp[0] += 1
			elif x == 'S':
				rsp[1] += 1
			else:
				rsp[2] += 1
		res = sorted(enumerate(rsp), key=lambda x: -x[1])
		if res[0][0] == 0:
			print(''.join(['P'] * n))
		elif res[0][0] == 1:
			print(''.join(['R'] * n))
		else:
			print(''.join(['S'] * n))
main()


def sol(s: str) -> str:
	(R, S, P) = (s.count('R'), s.count('S'), s.count('P'))
	maxs = max(R, S, P)
	if maxs == R:
		return 'P' * len(s)
	elif maxs == S:
		return 'R' * len(s)
	else:
		return 'S' * len(s)
tmp = []
p = print

def print(*args, **kwargs):
	tmp.append((args, kwargs))

def flush():
	for (args, kwargs) in tmp:
		p(*args, **kwargs)
	return
T = int(input())
for _ in range(T):
	s = input()
	out = sol(s)
	print(out)
flush()


for _ in range(int(input())):
	string = input()
	n = len(string)
	R = 0
	S = 0
	P = 0
	for s in string:
		if s == 'R':
			P += 1
		if s == 'S':
			R += 1
		if s == 'P':
			S += 1
	if R >= S and R >= P:
		print('R' * n)
	elif S >= R and S >= P:
		print('S' * n)
	elif P >= R and P >= S:
		print('P' * n)


t = int(input())
for _ in range(t):
	a = input()
	rCount = 0
	sCount = 0
	pCount = 0
	for elem in a:
		if elem == 'R':
			rCount += 1
		if elem == 'P':
			pCount += 1
		if elem == 'S':
			sCount += 1
	if rCount >= sCount and rCount >= pCount:
		print('P' * len(a))
	elif sCount >= rCount and sCount >= pCount:
		print('R' * len(a))
	else:
		print('S' * len(a))


for _ in range(int(input())):
	s = input()
	l = len(s)
	r = s.count('R')
	si = s.count('S')
	p = s.count('P')
	if r >= si and r >= p:
		print('P' * l)
	elif si >= r and si >= p:
		print('R' * l)
	elif p >= si and p >= r:
		print('S' * l)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	s = input().strip('\n')
	n = len(s)
	(R, P, S) = (s.count('R'), s.count('P'), s.count('S'))
	if max(R, P, S) == R:
		print('P' * n)
	elif max(R, P, S) == P:
		print('S' * n)
	else:
		print('R' * n)


from sys import stdin
T = int(stdin.readline().strip())
mp = dict()
mp['R'] = 'P'
mp['S'] = 'R'
mp['P'] = 'S'
for caso in range(T):
	s = stdin.readline().strip()
	ans = ''
	r = s.count('R')
	s1 = s.count('S')
	p = s.count('P')
	n = len(s)
	if r >= s1 and r >= p:
		print('P' * n)
	elif s1 >= r and s1 >= p:
		print('R' * n)
	else:
		print('S' * n)


t = int(input())
for test in range(t):
	s = input()
	sL = list(s)
	sS = set(sL)
	if len(sS) == len(sL) or len(sS) == 1:
		for i in s:
			if i == 'R':
				print('P', end='')
			if i == 'S':
				print('R', end='')
			if i == 'P':
				print('S', end='')
		print()
	else:
		ele = max(set(sL), key=sL.count)
		if ele == 'R':
			eleX = 'P'
		if ele == 'S':
			eleX = 'R'
		if ele == 'P':
			eleX = 'S'
		for i in range(len(s)):
			print(eleX, end='')
		print()


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for i in range(t):
	s = input().strip()
	(r, si, p) = (s.count('R'), s.count('S'), s.count('P'))
	print(len(s) * 'P' if r > si and r > p else len(s) * 'R' if si > p else len(s) * 'S')


for _ in range(int(input())):
	s = str(input())
	l = list(s)
	x = l.count('R')
	y = l.count('S')
	z = l.count('P')
	if x >= y and x >= z:
		for i in range(len(s)):
			print('P', end='')
	elif y >= x and y >= z:
		for i in range(len(s)):
			print('R', end='')
	elif z >= x and z >= y:
		for i in range(len(s)):
			print('S', end='')
	print()


for _ in range(int(input())):
	s = list(input())
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	m = max(R, max(S, P))
	R -= m
	S -= m
	P -= m
	if R == 0:
		print('P' * len(s))
	elif S == 0:
		print('R' * len(s))
	elif P == 0:
		print('S' * len(s))


import random

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def getinv(a):
	if a == 'S':
		return 'R'
	if a == 'P':
		return 'S'
	if a == 'R':
		return 'P'
for _ in range(int(input())):
	s = input()
	d = {}
	maxi = ''
	max_now = -1
	for i in s:
		if i not in d:
			d[i] = 1
			if d[i] > max_now:
				max_now = d[i]
				maxi = i
		else:
			d[i] += 1
			if d[i] > max_now:
				max_now = d[i]
				maxi = i
	print(getinv(maxi) * len(s))


for t in range(int(input())):
	s = list(input())
	a = s.count('R')
	b = s.count('S')
	c = s.count('P')
	m = max(a, max(b, c))
	if m == a:
		print('P' * len(s))
	elif m == b:
		print('R' * len(s))
	else:
		print('S' * len(s))


t = int(input())
for you in range(t):
	s = input()
	n = len(s)
	numofr = 0
	numofs = 0
	numofp = 0
	for i in s:
		if i == 'R':
			numofr += 1
		elif i == 'S':
			numofs += 1
		else:
			numofp += 1
	z = max(numofr, numofp, numofs)
	if z == numofr:
		print('P' * n)
	elif z == numofs:
		print('R' * n)
	else:
		print('S' * n)


from collections import Counter
k = []
for _ in range(int(input())):
	k.append(input())
for i in k:
	t = Counter(i)
	z = t.most_common()
	if z[0][0] == 'R':
		print('P' * len(i))
	elif z[0][0] == 'P':
		print('S' * len(i))
	else:
		print('R' * len(i))


for _ in range(int(input())):
	n = input()
	c = max('RSP', key=n.count)
	ans = {'R': 'P', 'P': 'S', 'S': 'R'}[c]
	print(ans * len(n))


from collections import Counter
t = int(input())
for _ in range(t):
	s = list(input())
	cnt = Counter(s).most_common()
	res = ''
	temp = ''
	if cnt[0][1] != 1:
		if cnt[0][0] == 'R':
			letter = 'P'
		elif cnt[0][0] == 'S':
			letter = 'R'
		else:
			letter = 'S'
		res = letter * len(s)
		print(res)
	else:
		for i in s:
			if i == 'R':
				letter = 'P'
			elif i == 'S':
				letter = 'R'
			else:
				letter = 'S'
			res += letter
		print(res)


t = int(input())
while t:
	t += -1
	(r, p, s) = (0, 0, 0)
	ss = input()
	for i in ss:
		if i == 'R':
			r -= -1
		if i == 'P':
			p -= -1
		if i == 'S':
			s -= -1
	if r >= p and r >= s:
		print('P' * len(ss))
	elif p >= r and p >= s:
		print('S' * len(ss))
	else:
		print('R' * len(ss))


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	s1 = ii()
	(r, s, p) = (0, 0, 0)
	for i in range(len(s1)):
		r += 1 if s1[i] == 'R' else 0
		s += 1 if s1[i] == 'S' else 0
		p += 1 if s1[i] == 'P' else 0
	if s >= max(r, p):
		print(len(s1) * 'R')
	elif r >= max(s, p):
		print(len(s1) * 'P')
	else:
		print(len(s1) * 'S')
for t in range(int(ii())):
	solve()


n = int(input())
for i in range(0, n):
	st = input()
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	if r >= p and r >= s:
		ans = 'P' * len(st)
	elif p >= r and p >= s:
		ans = 'S' * len(st)
	else:
		ans = 'R' * len(st)
	print(ans)


from collections import Counter

def f(s):
	if s == 'R':
		return 'P'
	if s == 'P':
		return 'S'
	if s == 'S':
		return 'R'
for w in range(int(input())):
	s = str(input())
	d = Counter(s)
	u = 'RSP'
	m = 0
	for i in u:
		if d[i] > m:
			m = d[i]
			v = i
	print(f(v) * len(s))


t = int(input())
for i in range(t):
	m = input()
	d = {}
	x = ''
	(r, s, p) = (0, 0, 0)
	for j in range(len(m)):
		if m[j] == 'R':
			r += 1
		elif m[j] == 'S':
			s += 1
		else:
			p += 1
	f = len(m)
	if r >= s and r >= p:
		print('P' * f)
	elif s >= r and s >= p:
		print('R' * f)
	else:
		print('S' * f)


import sys
input = sys.stdin.readline
from collections import *
for _ in range(int(input())):
	s = input()[:-1]
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	M = max(R, S, P)
	if R == M:
		print('P' * len(s))
	elif S == M:
		print('R' * len(s))
	else:
		print('S' * len(s))


t = int(input())
for _ in range(t):
	s = input()
	arr = [x for x in list(s)]
	n = len(arr)
	choice = {'R': 'P', 'S': 'R', 'P': 'S'}
	l = ''
	dic = {}
	for i in arr:
		if i not in dic:
			dic[i] = 1
		else:
			dic[i] += 1
	d = list(dic.items())
	d.sort(key=lambda x: x[1], reverse=True)
	ans = d[0][0]
	print(choice[ans] * n)


from collections import Counter, defaultdict, deque
import sys
input = sys.stdin.readline

def solve():
	s = input().strip()
	c = Counter(s)
	a = max(c.items(), key=lambda x: x[1])[0]
	t = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(t[a] * len(s))
tt = int(input())
for test in range(tt):
	solve()


T = int(input())
for ii in range(T):
	s = input()
	n = len(s)
	R = 0
	P = 0
	S = 0
	for i in s:
		if i == 'R':
			R += 1
		elif i == 'P':
			P += 1
		else:
			S += 1
	if max(R, P, S) == R:
		result = 'P' * n
	elif max(R, P, S) == P:
		result = 'S' * n
	else:
		result = 'R' * n
	print(result)


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def modefiedSieve():
	mx = 10 ** 7 + 1
	sieve = [-1] * mx
	for i in range(2, mx):
		if sieve[i] == -1:
			sieve[i] = i
			for j in range(i * i, mx, i):
				if sieve[j] == -1:
					sieve[j] = i
	return sieve

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]), reverse=True)

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def maxSubArraySum(a, size):
	maxint = 10 ** 10
	max_so_far = -maxint - 1
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] >= arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def solve():
	s = input()
	n = len(s)
	occur = {'P': 0, 'R': 0, 'S': 0}
	for i in s:
		occur[i] += 1
	occur = sort_dict(occur)
	(u, v) = occur[0]
	if u == 'R':
		print('P' * n)
	elif u == 'S':
		print('R' * n)
	else:
		print('S' * n)
t = 1
t = int(input())
for _ in range(t):
	solve()


from math import ceil

def main():
	t = int(input())
	for i in range(t):
		s = input()
		count_p = 0
		count_s = 0
		count_r = 0
		for i in s:
			if i == 'R':
				count_p += 1
			elif i == 'S':
				count_r += 1
			else:
				count_s += 1
		if count_p >= count_r and count_p >= count_s:
			print('P' * len(s))
		elif count_r >= count_p and count_r >= count_s:
			print('R' * len(s))
		else:
			print('S' * len(s))
main()


import sys
from collections import defaultdict
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	s = input()
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	ans = ''
	if d['R'] == max(d['R'], d['P'], d['S']):
		ans = 'P' * len(s)
	elif d['P'] == max(d['R'], d['P'], d['S']):
		ans = 'S' * len(s)
	else:
		ans = 'R' * len(s)
	print(ans)


from math import *
for u in range(int(input())):
	s = input()
	n = len(s)
	(x, y, z) = (s.count('R'), s.count('S'), s.count('P'))
	if x <= y <= z or y <= x <= z:
		print('S' * n)
	elif x <= z <= y or z <= x <= y:
		print('R' * n)
	else:
		print('P' * n)


def solve():
	lst = list(input())
	n = len(lst)
	r = 0
	s = 0
	p = 0
	for i in lst:
		if i == 'R':
			p += 1
		if i == 'S':
			r += 1
		if i == 'P':
			s += 1
	q = max([r, s, p])
	if r == q:
		print('R' * n)
	elif s == q:
		print('S' * n)
	else:
		print('P' * n)
for i in range(int(input())):
	solve()


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	s = input()
	n = len(s)
	(r, s, p) = (s.count('R'), s.count('S'), s.count('P'))
	mx = max(r, s, p)
	if mx == r:
		print('P' * n)
	elif mx == s:
		print('R' * n)
	else:
		print('S' * n)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for i in range(t):
	s = get_str()
	rc = s.count('R')
	sc = s.count('S')
	pc = s.count('P')
	if rc >= sc and rc >= pc:
		print('P' * len(s))
	elif sc >= rc and sc >= pc:
		print('R' * len(s))
	else:
		print('S' * len(s))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	for _ in range(ii()):
		s = input()
		ss = collections.Counter(s)
		k = max(ss, key=ss.get)
		if k == 'R':
			print('P' * len(s))
		elif k == 'S':
			print('R' * len(s))
		else:
			print('S' * len(s))
main()


def solve(s, ans):
	n = len(s)
	s1 = []
	r = s.count('R')
	p = s.count('P')
	sc = s.count('S')
	if sc == max(sc, p, r):
		move = 'R'
	elif p == max(sc, p, r):
		move = 'S'
	else:
		move = 'P'
	for i in range(n):
		s1.append(move)
	ans.append(s1)

def main():
	t = int(input())
	ans = []
	for i in range(t):
		s = input()
		solve(s, ans)
	for i in ans:
		for j in i:
			print(j, end='')
		print()
main()


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	c = Counter(s)
	m = 0
	for j in c:
		if c[j] > m:
			m = c[j]
			s1 = j
	if s1 == 'P':
		s1 = 'S'
	elif s1 == 'R':
		s1 = 'P'
	else:
		s1 = 'R'
	print(s1 * n)


for _ in range(int(input())):
	s = input()
	ss = list(s)
	rcount = ss.count('R')
	scount = ss.count('S')
	pcount = ss.count('P')
	mymax = max(pcount, scount, rcount)
	if mymax == rcount:
		print('P' * len(s))
	elif mymax == scount:
		print('R' * len(s))
	else:
		print('S' * len(s))


for i in range(int(input())):
	n = input()
	d = {'R': 0, 'S': 0, 'P': 0}
	for i in n:
		d[i] += 1
	if d['R'] > d['S'] and d['R'] > d['P']:
		print('P' * len(n))
	elif d['P'] > d['S']:
		print('S' * len(n))
	else:
		print('R' * len(n))


def win(s):
	l = len(s)
	r = s.count('R')
	S = s.count('S')
	p = s.count('P')
	m = max(r, S, p)
	if r == m:
		return 'P' * l
	if S == m:
		return 'R' * l
	else:
		return 'S' * l
t = int(input())
for _ in range(t):
	s = input()
	print(win(s))


abc = int(input())
for x in range(abc):
	s = input()
	n = len(s)
	n1 = s.count('R')
	n2 = s.count('P')
	n3 = n - n1 - n2
	A = []
	m = max(n1, n2, n3)
	if m == n1:
		A.append('P' * n)
	elif m == n2:
		A.append('S' * n)
	else:
		A.append('R' * n)
	print(''.join(A))


for _ in range(0, int(input())):
	s = list(input())
	rock = s.count('R')
	paper = s.count('P')
	scissors = s.count('S')
	if rock >= paper and rock >= scissors:
		print('P' * len(s))
	elif paper >= rock and paper >= scissors:
		print('S' * len(s))
	else:
		print('R' * len(s))


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	s = input()
	s = list(s)
	(vs, vr, vp) = (0, 0, 0)
	for i in range(len(s)):
		if s[i] == 'S':
			vs += 1
		elif s[i] == 'R':
			vr += 1
		else:
			vp += 1
	if vr >= vs and vr >= vp:
		ans = 'P' * len(s)
	elif vs >= vr and vs >= vp:
		ans = 'R' * len(s)
	else:
		ans = 'S' * len(s)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	a = list(input())
	n = len(a)
	c = Counter(a).most_common(1)[0][0]
	if c == 'R':
		print('P' * n)
	elif c == 'P':
		print('S' * n)
	elif c == 'S':
		print('R' * n)


def process(s):
	n = len(s)
	beat = {'R': 'P', 'P': 'S', 'S': 'R'}
	mapp = {'R': 0, 'S': 0, 'P': 0}
	for ele in set(s):
		for char in s:
			if ele == char:
				mapp[ele] += 1
	inv_map = {num: ch for (ch, num) in mapp.items()}
	e = beat[inv_map[max(inv_map)]]
	print(e * n)
T = int(input())
for i in range(T):
	s = input()
	process(s)


import collections

def main():
	s = list(input())
	m = {'R': 'P', 'S': 'R', 'P': 'S'}
	c = collections.Counter(s).most_common(3)
	print(m[c[0][0]] * len(s))
for _ in range(int(input())):
	main()


t = int(input())
for i in range(t):
	s = input()
	l = len(s)
	m = 0
	for each in set(s):
		if s.count(each) > m:
			m = s.count(each)
			x = each
	if x == 'R':
		print('P' * l)
	elif x == 'S':
		print('R' * l)
	elif x == 'P':
		print('S' * l)


production = True
import sys, math, collections

def input(input_format=0, multi=0):
	if multi > 0:
		return [input(input_format) for i in range(multi)]
	else:
		next_line = sys.stdin.readline()[:-1]
		if input_format >= 10:
			use_list = False
			input_format = int(str(input_format)[-1])
		else:
			use_list = True
		if input_format == 0:
			formatted_input = [next_line]
		elif input_format == 1:
			formatted_input = list(map(int, next_line.split()))
		elif input_format == 2:
			formatted_input = list(map(float, next_line.split()))
		elif input_format == 3:
			formatted_input = list(next_line)
		elif input_format == 4:
			formatted_input = list(map(int, list(next_line)))
		elif input_format == 5:
			formatted_input = next_line.split()
		else:
			formatted_input = [next_line]
		return formatted_input if use_list else formatted_input[0]

def out(output_line, output_format=0, newline=True):
	formatted_output = ''
	if output_format == 0:
		formatted_output = str(output_line)
	elif output_format == 1:
		formatted_output = ' '.join(map(str, output_line))
	elif output_format == 2:
		formatted_output = '\n'.join(map(str, output_line))
	print(formatted_output, end='\n' if newline else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)

def mapl(iterable, format=0):
	if format == 0:
		return list(map(int, iterable))
	elif format == 1:
		return list(map(str, iterable))
	elif format == 2:
		return list(map(list, iterable))

def solve():
	s = input(3)
	u = [0] * 3
	for i in s:
		if i == 'R':
			u[0] += 1
		elif i == 'P':
			u[1] += 1
		elif i == 'S':
			u[2] += 1
	log(u)
	y = 0
	p = 0
	for (i, j) in enu(u):
		if j > y:
			y = j
			p = i
	if p == 0:
		a = 'P'
	elif p == 1:
		a = 'S'
	elif p == 2:
		a = 'R'
	out(a * len(s))
	return
for i in range(input(11)):
	solve()


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	a = s.count('P')
	b = s.count('R')
	c = s.count('S')
	if b >= c and b >= a:
		print('P' * n)
	elif a >= b and a >= c:
		print('S' * n)
	else:
		print('R' * n)


for _ in range(int(input())):
	x = input()
	l = len(x)
	(r, s, p) = (x.count('R'), x.count('S'), x.count('P'))
	if r <= s <= p or s <= r <= p:
		print('S' * l)
	elif s <= p <= r or p <= s <= r:
		print('P' * l)
	else:
		print('R' * l)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	s = inp()
	count = [0] * 3
	for i in s:
		if i == 'R':
			count[0] += 1
		if i == 'S':
			count[1] += 1
		if i == 'P':
			count[2] += 1
	if count[0] == max(count):
		print('P' * len(s))
	elif count[1] == max(count):
		print('R' * len(s))
	else:
		print('S' * len(s))


for test_i in range(int(input())):
	s = input()
	l = len(s)
	(n1, n2, n3) = (s.count('R'), s.count('S'), s.count('P'))
	if n2 <= n1 >= n3:
		print('P' * l)
	elif n1 <= n2 >= n3:
		print('R' * l)
	else:
		print('S' * l)


t = int(input())
for s in range(t):
	string = input()
	(r, s, p) = (0, 0, 0)
	for i in string:
		if i == 'R':
			r += 1
		elif i == 'S':
			s += 1
		else:
			p += 1
	maxi = max(r, s, p)
	add = r + s + p
	x = 0
	if maxi == r:
		x = 'P'
	elif maxi == s:
		x = 'R'
	else:
		x = 'S'
	for i in range(add):
		print(x, end='')
	print()


t = input()
t = int(t)

def max(a, b):
	if a > b:
		return a
	return b
while t > 0:
	t -= 1
	s = input()
	l = [0, 0, 0]
	for i in range(0, len(s)):
		if s[i] == 'R':
			l[0] += 1
		elif s[i] == 'P':
			l[1] += 1
		else:
			l[2] += 1
	max1 = max(max(l[0], l[1]), l[2])
	ans = 'R'
	if max1 == l[0]:
		ans = 'P'
	elif max1 == l[1]:
		ans = 'S'
	for i in range(0, len(s)):
		print(ans, end='')
	print('')


for test in range(int(input())):
	s = input()
	r = s.count('R')
	p = s.count('P')
	s1 = s.count('S')
	if r >= p and r >= s1:
		print('P' * len(s))
	elif p >= r and p >= s1:
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
while t:
	dict1 = {'R': 'P', 'P': 'S', 'S': 'R'}
	dict2 = {}
	s = input()
	for i in s:
		if i in dict2:
			dict2[i] += 1
		else:
			dict2[i] = 1
	max1 = 0
	ans = ''
	for i in dict2:
		if max1 < dict2[i]:
			ans = i
			max1 = dict2[i]
	ans1 = ''
	for i in range(len(s)):
		ans1 += dict1[ans]
	print(ans1)
	t -= 1


T = int(input())

def solve():
	S = input()
	count = {}
	count['R'] = 0
	count['P'] = 0
	count['S'] = 0
	for a in S:
		count[a] += 1
	build = []
	for k in count:
		v = count[k]
		build.append((v, k))
	build = sorted(build)
	(_, M) = build[2]
	if M == 'R':
		print(''.join(['P' * len(S)]))
	if M == 'P':
		print(''.join(['S' * len(S)]))
	if M == 'S':
		print(''.join(['R' * len(S)]))
for _ in range(T):
	solve()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	st = input().lower()
	(r, s, p) = (0, 0, 0)
	for i in st:
		if i == 'r':
			r += 1
		if i == 's':
			s += 1
		if i == 'p':
			p += 1
	m = max(r, s, p)
	n = len(st)
	if m == r:
		print('P' * n)
	elif m == s:
		print('R' * n)
	elif m == p:
		print('S' * n)


from sys import stdin, gettrace
from collections import Counter
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	ss = input()
	css = Counter(ss)
	(a, _) = css.most_common(1)[0]
	if a == 'R':
		b = 'P'
	elif a == 'P':
		b = 'S'
	else:
		b = 'R'
	print(b * len(ss))

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


from collections import Counter
ch = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	ca = input()
	s = Counter(ca)
	print(ch[s.most_common(1)[0][0]] * len(ca))


for i in range(int(input())):
	s = input()
	n = len(s)
	cnt1 = s.count('R')
	cnt2 = s.count('P')
	cnt3 = s.count('S')
	m = max(cnt1, cnt2, cnt3)
	if m == cnt1:
		print(n * 'P')
	elif m == cnt2:
		print(n * 'S')
	else:
		print(n * 'R')


for _ in range(int(input())):
	t = input()
	l = len(t)
	r = p = s = 0
	for i in t:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
	if p <= r >= s:
		print('P' * l)
	elif r <= p >= s:
		print('S' * l)
	else:
		print('R' * l)


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	word = input()
	n = len(word)
	r = word.count('R')
	p = word.count('P')
	s = word.count('S')
	maxi = max(r, p, s)
	if r == maxi:
		print('P' * n)
	elif p == maxi:
		print('S' * n)
	elif s == maxi:
		print('R' * n)


t = int(input())
while t:
	z = input()
	n = len(z)
	(r, s, p) = (0, 0, 0)
	for i in range(n):
		if z[i] == 'R':
			r += 1
		if z[i] == 'P':
			p += 1
		if z[i] == 'S':
			s += 1
	if r >= s and r >= p:
		for i in range(n):
			print('P', end='')
	elif p >= s and p >= r:
		for i in range(n):
			print('S', end='')
	else:
		for i in range(n):
			print('R', end='')
	print()
	t -= 1


t = int(input())
for _ in range(t):
	l = input()
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	figures = ['R', 'P', 'S']
	counts = [l.count('R'), l.count('P'), l.count('S')]
	print(d[figures[counts.index(max(counts))]] * len(l))


t = int(input())
x = ['R', 'S', 'P']
for _ in range(t):
	s = list(input())
	n = len(s)
	cnt = [s.count(x[i]) for i in range(3)]
	c = x[(cnt.index(max(cnt)) - 1) % 3]
	print(c * n)


for _ in range(int(input())):
	s = list(input())
	r = s.count('R')
	se = s.count('S')
	p = s.count('P')
	a = max(r, se, p)
	if a == r:
		print('P' * len(s))
	elif a == se:
		print('R' * len(s))
	else:
		print('S' * len(s))


for i in '*' * int(input()):
	s = input()
	l = [s.count('S'), s.count('P'), s.count('R')]
	print(['S', 'P', 'R'][l.index(max(l)) - 1] * len(s))


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import Counter
for _ in range(ii()):
	a = list(si())
	C = Counter(a)
	n = len(a)
	b = []
	k = []
	for c in C:
		b.append(C[c])
		k.append(c)
	if k[b.index(max(b))] == 'R':
		print('P' * n)
	elif k[b.index(max(b))] == 'P':
		print('S' * n)
	else:
		print('R' * n)


from collections import Counter
for i in range(int(input())):
	s = input()
	states = Counter()
	for j in range(len(s)):
		states[s[j]] += 1
	if states['R'] >= states['S'] and states['R'] >= states['P']:
		print('P' * int(len(s)))
	elif states['S'] >= states['P'] and states['S'] >= states['R']:
		print('R' * int(len(s)))
	else:
		print('S' * int(len(s)))


for _ in range(int(input())):
	st = input()
	le = len(st)
	ro = 0
	pa = 0
	sc = 0
	for i in st:
		if i == 'R':
			ro += 1
		elif i == 'P':
			pa += 1
		else:
			sc += 1
	ma = max(ro, pa, sc)
	if ro == ma:
		print('P' * le)
	elif pa == ma:
		print('S' * le)
	else:
		print('R' * le)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	s = is1()
	d = Counter(s)
	max_ele = max(d, key=lambda x: d[x])
	if max_ele == 'P':
		print('S' * len(s))
	elif max_ele == 'R':
		print('P' * len(s))
	else:
		print('R' * len(s))


t = int(input())
for i in range(t):
	s = input()
	v1 = s.count('R')
	v2 = s.count('P')
	v3 = s.count('S')
	n = max(v1, v2, v3)
	if n == v1:
		l = 'P' * len(s)
	elif n == v2:
		l = 'S' * len(s)
	else:
		l = 'R' * len(s)
	print(l)


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
from collections import Counter
d = {'S': 'R', 'R': 'P', 'P': 'S'}
t = iinput()
while t:
	t -= 1
	s = input()
	m = Counter(s).most_common()[0][0]
	print(d[m] * len(s))


T = input()
for t in range(int(T)):
	S = input()
	maxOccurrence = 0
	myChoices = ''
	rCount = S.count('R')
	sCount = S.count('S')
	pCount = S.count('P')
	if rCount >= sCount and rCount >= pCount:
		maxOccurrence = 'R'
	elif sCount >= rCount and sCount >= pCount:
		maxOccurrence = 'S'
	else:
		maxOccurrence = 'P'
	if maxOccurrence == 'R':
		myChoices = 'P' * len(S)
	elif maxOccurrence == 'S':
		myChoices = 'R' * len(S)
	else:
		myChoices = 'S' * len(S)
	print(myChoices)


t = int(input())
for _ in range(t):
	msg = input()
	(r, s, p) = (0, 0, 0)
	for w in msg:
		if w == 'R':
			r += 1
		if w == 'S':
			s += 1
		if w == 'P':
			p += 1
	if max(r, s, p) == r:
		print('P' * len(msg))
	elif max(r, s, p) == s:
		print('R' * len(msg))
	elif max(r, s, p) == p:
		print('S' * len(msg))


from math import *
t = int(input())
for _ in range(t):
	s = list(input())
	n = len(s)
	l = []
	k = s.count('R')
	m = s.count('S')
	b = s.count('P')
	a = max(k, m, b)
	if a == k:
		l = ['P'] * n
	elif a == m:
		l = ['R'] * n
	elif a == b:
		l = ['S'] * n
	for i in range(n):
		print(l[i], end='')
	print()


t = int(input())
for _ in range(t):
	a = input()
	d = 1
	c = [[a.count('P'), 'S'], [a.count('R'), 'P'], [a.count('S'), 'R']]
	b = max(c)[1] * len(a)
	print(b)


for _ in range(int(input())):
	s = input()
	o = max('RSP', key=lambda x: s.count(x))
	if o == 'R':
		o = 'P'
	elif o == 'S':
		o = 'R'
	else:
		o = 'S'
	print(o * len(s))


for _ in range(int(input())):
	st = list(input())
	n = len(st)
	ans = str()
	for i in range(n):
		if st[i] == 'R':
			ans += 'P'
		if st[i] == 'P':
			ans += 'S'
		if st[i] == 'S':
			ans += 'R'
	t = ans.count('P')
	y = ans.count('R')
	w = ans.count('S')
	if max(t, y, w) == t:
		sd = 'P'
		print(sd * n)
	elif max(t, y, w) == y:
		sd = 'R'
		print(sd * n)
	elif max(t, y, w) == w:
		sd = 'S'
		print(sd * n)


def most_frequent(lineup):
	ans = {}
	for i in lineup:
		if i in ans:
			ans[i] += 1
		else:
			ans[i] = 1
	max_value = -1
	for j in ans:
		max_value = max(max_value, ans[j])
		if max_value == ans[j]:
			printed = j
	if printed == 'R':
		return 'P'
	elif printed == 'P':
		return 'S'
	else:
		return 'R'
for i in range(int(input())):
	lineup = list(input())
	tobeprint = []
	print(*[most_frequent(lineup)] * len(lineup), sep='')


t = int(input())
for _ in range(t):
	s = str(input())
	n = len(s)
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	m = max(P, R, S)
	if R == m:
		print('P' * n)
	elif S == m:
		print('R' * n)
	else:
		print('S' * n)


from collections import Counter
dic = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(dic[s[0]] * len(s))
	else:
		arr = Counter(s)
		maxi = arr.most_common(1)[0][0]
		ans = dic[maxi] * len(s)
		print(ans)


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial, cos, sin, pi
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, accumulate
from string import ascii_lowercase, ascii_uppercase
from bisect import *
from functools import reduce
from operator import mul
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
d = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(I()):
	st = S()
	print(d[Counter(st).most_common()[0][0]] * len(st))
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


t = int(input())

def majorityCnt(classList):
	count_dict = {}
	for label in classList:
		if label not in count_dict.keys():
			count_dict[label] = 0
		count_dict[label] += 1
	return max(zip(count_dict.values(), count_dict.keys()))[1]
for _ in range(t):
	s = list(input())
	res_dict = {'S': 'R', 'R': 'P', 'P': 'S'}
	print(res_dict[majorityCnt(s)] * len(s))


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		s = si()
		s1 = ''
		n = len(s) - 1
		m = dd(int)
		for i in s:
			m[i] += 1
		x = 0
		for i in m.keys():
			if m[i] > x:
				c = i
				x = m[i]
		if c == 'R':
			c = 'P'
		elif c == 'P':
			c = 'S'
		elif c == 'S':
			c = 'R'
		print(c * n)
if file:
	if path.exists('input1.txt'):
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


for _ in range(int(input())):
	str = input()
	ans = ''
	freq = {'R': 0, 'S': 0, 'P': 0}
	for i in str:
		if i == 'R':
			freq['R'] += 1
		elif i == 'S':
			freq['S'] += 1
		else:
			freq['P'] += 1
	k = max(freq['R'], freq['S'], freq['P'])
	if k == freq['R']:
		ans = 'P' * len(str)
	elif k == freq['S']:
		ans = 'R' * len(str)
	else:
		ans = 'S' * len(str)
	print(ans)


for _ in range(int(input())):
	s = input()
	d = {'R': 0, 'P': 0, 'S': 0}
	max_pair = (0, 'R')
	for i in s:
		d[i] += 1
		if (d[i], i) > max_pair:
			max_pair = (d[i], i)
	if max_pair[1] == 'R':
		print('P' * len(s))
	elif max_pair[1] == 'P':
		print('S' * len(s))
	else:
		print('R' * len(s))


for _ in range(int(input())):
	st = input()
	n = len(st)
	(r, p, s) = (0, 0, 0)
	for i in range(n):
		if st[i] == 'R':
			r += 1
		elif st[i] == 'P':
			p += 1
		else:
			s += 1
	x = max(r, p, s)
	if x == r:
		print('P' * n)
	elif x == p:
		print('S' * n)
	else:
		print('R' * n)


from collections import defaultdict
for _ in range(int(input())):
	(d, a, b, c) = (defaultdict(lambda : 0), 0, 0, 0)
	for i in input():
		d[i] += 1
	for j in d:
		c += d[j]
		if d[j] > a:
			b = j
			a = d[j]
	if b == 'R':
		print('P' * c)
	elif b == 'P':
		print('S' * c)
	else:
		print('R' * c)


n = int(input())
for i in range(n):
	s = input()
	t = 1
	r = 0
	k = s.count('P')
	l = s.count('S')
	m = s.count('R')
	y = max(k, l, m)
	if y == k:
		print('S' * len(s))
		t = 0
		r = 1
	if y == l and t != 0:
		print('R' * len(s))
		r = 1
	if y == m and r != 1:
		print('P' * len(s))


from math import *
from collections import *
from bisect import *
import sys
input = sys.stdin.readline
t = int(input())
cc = 0
gg = {'R': 'P', 'S': 'R', 'P': 'S'}
while t:
	t -= 1
	s = input().rstrip('\n')
	(a, b, c) = (s.count('P'), s.count('R'), s.count('S'))
	f = [[a, 'S'], [b, 'P'], [c, 'R']]
	f.sort()
	r = ''
	r += f[-1][1] * f[-1][0]
	if f[-2][0] == f[-1][0]:
		r += f[-2][1] * f[-2][0]
	if f[-1][0] == f[-3][0]:
		r += f[-3][1] * f[-3][0]
	r += f[-1][1] * (len(s) - len(r))
	print(r)


from collections import Counter
d = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	a = input()
	n = len(a)
	di = Counter(a)
	maxi = max(di, key=di.get)
	print(d[maxi] * n)


for _ in range(int(input())):
	s = input()
	d = {'R': 0, 'S': 1, 'P': 2}
	cnt = [0, 0, 0]
	ctr = ['P', 'R', 'S']
	for i in s:
		cnt[d[i]] += 1
	print(ctr[cnt.index(max(cnt))] * len(s))


n = int(input())
for _ in range(n):
	string = input()
	R = [string.count('R'), 'P']
	S = [string.count('S'), 'R']
	P = [string.count('P'), 'S']
	ans = max([P, S, R])[1] * len(string)
	print(ans)


import collections
dictt = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	s = str(input())
	a = collections.Counter(s).most_common()[0][0]
	q = dictt[a]
	print(q * len(s))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def mex(li):
	check = [0] * 1001
	for i in li:
		check[i] += 1
	for i in range(len(check)):
		if check[i] == 0:
			return i

def sumdigits(n):
	ans = 0
	while n != 0:
		ans += n % 10
		n //= 10
	return ans
from math import *
for _ in range(int(input())):
	st = input()
	ans = ['P', 'R', 'S']
	c = [0, 0, 0]
	for i in st:
		if i == 'R':
			c[0] += 1
		elif i == 'S':
			c[1] += 1
		else:
			c[2] += 1
	string = ans[c.index(max(c))] * len(st)
	print(string)


import os
from math import *
t = int(input())
while t:
	t -= 1
	s = input()
	s = list(s)
	p = list(filter(lambda x: x == 'P', s))
	r = list(filter(lambda x: x == 'R', s))
	ss = list(filter(lambda x: x == 'S', s))
	m = max(len(p), len(r), len(ss))
	val = ''
	if len(p) == m:
		val = 'S'
	elif len(r) == m:
		val = 'P'
	else:
		val = 'R'
	for i in range(len(s)):
		print(val, end='')
	print()


t = int(input())
while t > 0:
	t -= 1
	ln = list(input())
	alt = []
	(r, p, s) = (0, 0, 0)
	for hand in ln:
		if hand == 'R':
			p += 1
			alt.append('P')
		elif hand == 'P':
			s += 1
			alt.append('S')
		elif hand == 'S':
			r += 1
			alt.append('R')
	if r > p and r > s:
		print(len(ln) * 'R')
	elif p > r and p > s:
		print(len(ln) * 'P')
	elif s > r and s > p:
		print(len(ln) * 'S')
	elif r == p and p == s:
		print(''.join(alt))
	elif r == p and p > s:
		print(len(ln) * 'R')
	elif p == s and s > r:
		print(len(ln) * 'P')
	elif s == r and r > p:
		print(len(ln) * 'S')
	else:
		print('what')


for _ in ' ' * int(input()):
	b = input()
	r = len(b)
	z = b.count('R')
	z1 = b.count('P')
	z2 = b.count('S')
	if z == max(z, z1, z2):
		print('P' * r)
	elif z1 == max(z, z1, z2):
		print('S' * r)
	else:
		print('R' * r)


t = int(input())
for _ in range(t):
	ip = input()
	n = len(ip)
	l = [0, 0, 0]
	d = {'r': 0, 'p': 0, 's': 0}
	for i in ip:
		if i == 'R':
			d['r'] += 1
		elif i == 'P':
			d['p'] += 1
		else:
			d['s'] += 1
	d1 = sorted(d.items(), key=lambda x: x[1], reverse=True)
	temp = d1[0][0]
	if temp == 'r':
		print('P' * n)
	elif temp == 'p':
		print('S' * n)
	else:
		print('R' * n)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from collections import Counter as cc
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	x = s.count('R')
	y = s.count('P')
	z = s.count('S')
	if x >= y and x >= z:
		print('P' * n)
	elif y >= x and y >= z:
		print('S' * n)
	elif z >= x and z >= y:
		print('R' * n)


t = int(input())
from collections import defaultdict
while t > 0:
	s = input()
	out = []
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	maxi = 0
	p = 0
	for i in d.keys():
		if d[i] > maxi:
			maxi = d[i]
			p = i
	if p == 'P':
		p = 'S'
	elif p == 'R':
		p = 'P'
	else:
		p = 'R'
	for i in range(len(s)):
		print(p, end='')
	print()
	t -= 1


t = int(input())
for test in range(t):
	s = input()
	d = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		d[i] += 1
	ans = sorted(d, key=lambda x: d[x], reverse=True)
	sols = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(sols[ans[0]] * len(s))


for _ in range(int(input())):
	s = input()
	l = len(s)
	c = {'R': 0, 'S': 0, 'P': 0}
	for i in s:
		c[i] += 1
	mv = max(list(c.values()))
	for i in c:
		if c[i] == mv:
			if i == 'R':
				print('P' * l)
				break
			elif i == 'S':
				print('R' * l)
				break
			else:
				print('S' * l)
				break


t = int(input())
for _ in range(t):
	s = str(input())
	n = len(s)
	d = {}
	for x in s:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	mn = -1
	fx = None
	for x in d:
		if mn < d[x]:
			mn = d[x]
			fx = x
	if fx == 'R':
		c = 'P' * n
	elif fx == 'P':
		c = 'S' * n
	else:
		c = 'R' * n
	print(c)


def checker(orig, ans):
	for i in range(len(orig)):
		score = 0
		cnt = 0
		for j in range(i, i + len(orig)):
			ind = j % len(orig)
			if orig[ind] == 'P' and ans[cnt] == 'S':
				score += 1
			elif orig[ind] == 'S' and ans[cnt] == 'R':
				score += 1
			elif orig[ind] == 'R' and ans[cnt] == 'P':
				score += 1
			cnt += 1
		print(i, score)
t = int(input())
for ii in range(t):
	sp = input()
	ans = []
	r = 0
	s = 0
	p = 0
	for i in sp:
		if i == 'R':
			p += 1
		elif i == 'S':
			r += 1
		else:
			s += 1
	l = [(r, 'R'), (s, 'S'), (p, 'P')]
	l.sort()
	ans = [l[-1][1]] * len(sp)
	for i in ans:
		print(i, end='')
	print()


t = int(input())
l = []
for i in range(t):
	n = input()
	l.append(n)
for x in l:
	rcount = 0
	pcount = 0
	scount = 0
	for a in x:
		if a == 'R':
			rcount += 1
		if a == 'S':
			scount += 1
		if a == 'P':
			pcount += 1
	h = [rcount, scount, pcount]
	if max(h) == rcount:
		print('P' * len(x))
	elif max(h) == scount:
		print('R' * len(x))
	elif max(h) == pcount:
		print('S' * len(x))


for _ in range(int(input())):
	s = input()
	(x, y, z) = (0, 0, 0)
	k = ''
	for i in range(len(s)):
		if s[i] == 'R':
			x += 1
		elif s[i] == 'S':
			y += 1
		else:
			z += 1
	if x >= y and x >= z:
		k = k + 'P' * len(s)
	elif y >= x and y >= z:
		k = k + 'R' * len(s)
	elif z >= x and z >= y:
		k = k + 'S' * len(s)
	print(k)


import sys

def input():
	return sys.stdin.readline().rstrip()

def input_split():
	return [int(i) for i in input().split()]
testCases = int(input())
answers = []
for _ in range(testCases):
	s = input()
	counts = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		counts[i] += 1
	defeats = {'R': 'P', 'P': 'S', 'S': 'R'}
	max_key = max(counts, key=counts.get)
	ans = defeats[max_key] * len(s)
	answers.append(ans)
print(*answers, sep='\n')


def solve():
	s = input()
	d = {'R': 0, 'S': 0, 'P': 0}
	for i in s:
		d[i] += 1
	x = float('-inf')
	for i in d:
		if d[i] > x:
			k = i
			x = d[i]
	if k == 'R':
		print('P' * len(s))
	elif k == 'S':
		print('R' * len(s))
	else:
		print('S' * len(s))
t = int(input())
for _ in range(t):
	solve()


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	s = sys.stdin.readline().rstrip()
	re = ''
	cnt = {}
	for i in s:
		if i not in cnt:
			cnt[i] = 1
		else:
			cnt[i] += 1
	max_v = -1
	re = ''
	for (i, v) in cnt.items():
		if max_v < v:
			max_v = v
			re = i
	if re == 'R':
		re = 'P'
	elif re == 'S':
		re = 'R'
	elif re == 'P':
		re = 'S'
	print(re * len(s))


t = int(input())
from collections import Counter
for i in range(t):
	s = input()
	n = len(s)
	c = Counter(s)
	x = ''
	for (a, b) in c.most_common(1):
		x = a
	if x == 'R':
		print('P' * n)
	elif x == 'P':
		print('S' * n)
	else:
		print('R' * n)


d = {}
d['R'] = 'P'
d['P'] = 'S'
d['S'] = 'R'
for n in range(int(input())):
	s = list(input())
	v = {}
	v['R'] = s.count('R')
	v['P'] = s.count('P')
	v['S'] = s.count('S')
	mx = max(v['R'], v['P'], v['S'])
	for n in v:
		if v[n] == mx:
			print(d[n] * len(s))
			break


import sys
input = sys.stdin.readline
from collections import Counter

def print(val):
	sys.stdout.write(val)
	sys.stdout.write('\n')

def prog():
	win = {'R': 'P', 'S': 'R', 'P': 'S'}
	for _ in range(int(input())):
		s = input().strip()
		n = len(s)
		s1 = Counter(s)
		letter = s1.most_common(1)[0][0]
		print(win[letter] * n)
prog()


def find_ans(s):
	q = [0] * 3
	for i in s:
		if i == 'P':
			q[0] += 1
		elif i == 'S':
			q[1] += 1
		else:
			q[2] += 1
	u = max(q)
	if u == q[0]:
		print('S' * len(s))
	elif u == q[1]:
		print('R' * len(s))
	else:
		print('P' * len(s))
for _ in range(int(input())):
	s = input()
	find_ans(s)


import sys
input = sys.stdin.readline
MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input().strip('\n'))
si = lambda : input().strip('\n')
dgl = lambda : list(map(int, input().strip('\n')))
f = lambda : map(int, input().strip('\n').split())
il = lambda : list(map(int, input().strip('\n').split()))
ls = lambda : list(input().strip('\n'))
lsc = lambda : list(input().strip('\n').split(' '))
lsi = lambda : [int(i) for i in ls()]
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(ii()):
	s = si()
	n = len(s)
	rc = s.count('R')
	sc = s.count('S')
	pc = s.count('P')
	x = max(rc, pc, sc)
	if x == rc:
		print('P' * n)
	elif x == pc:
		print('S' * n)
	else:
		print('R' * n)


import sys
all_data = sys.stdin.read().split('\n')
for i in range(1, int(all_data[0]) + 1):
	if all_data[i].count('R') == max(all_data[i].count('R'), all_data[i].count('S'), all_data[i].count('P')):
		print('P' * len(all_data[i]))
	elif all_data[i].count('S') == max(all_data[i].count('R'), all_data[i].count('S'), all_data[i].count('P')):
		print('R' * len(all_data[i]))
	else:
		print('S' * len(all_data[i]))


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	s = inputstring()
	d = {'R': 0, 'P': 0, 'S': 0}
	cnt = 0
	letter = ''
	for c in s:
		d[c] += 1
		if d[c] > cnt:
			cnt = d[c]
			letter = c
	ans = ''
	if letter == 'R':
		ans = 'P'
	elif letter == 'P':
		ans = 'S'
	elif letter == 'S':
		ans = 'R'
	for i in range(len(s)):
		print(ans, end='')
	print()


tests = int(input())
sol = []
while tests:
	tests -= 1
	s = input()
	n = len(s)
	d = {}
	d['S'] = 0
	d['R'] = 0
	d['P'] = 0
	cuv = ''
	for i in s:
		d[i] += 1
	d = [(i, d[i]) for i in d.keys()]
	d.sort(key=lambda a: a[1], reverse=True)
	d = d[0][0]
	if d == 'S':
		cuv = 'R' * n
	elif d == 'P':
		cuv = 'S' * n
	else:
		cuv = 'P' * n
	sol.append(cuv)
for i in sol:
	print(i)


from collections import defaultdict
from math import ceil
for _ in range(int(input())):
	d = defaultdict(int)
	s = list(input())
	l = len(s)
	for i in s:
		if i == 'P':
			d['P'] += 1
		elif i == 'R':
			d['R'] += 1
		else:
			d['S'] += 1
	if d['P'] == l or d['P'] > l // 2:
		print('S' * l)
	elif d['S'] == l or d['S'] > l // 2:
		print('R' * l)
	elif d['R'] == l or d['R'] > l // 2:
		print('P' * l)
	elif d['R'] == d['P'] == d['S']:
		for i in s:
			if i == 'P':
				print('S', end='')
			elif i == 'R':
				print('P', end='')
			else:
				print('R', end='')
		print()
	elif d['P'] >= d['R'] and d['P'] >= d['S']:
		print('S' * l)
	elif d['S'] >= d['R'] and d['S'] >= d['P']:
		print('R' * l)
	elif d['R'] >= d['P'] and d['R'] >= d['S']:
		print('P' * l)


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))
mo = 1000000007
for _ in range(inn()):
	s = input()
	ans = ''
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	if d['R'] == d['S'] == d['P']:
		ans = 'R' * d['R'] + 'S' * d['S'] + 'P' * d['P']
	else:
		mx = max(d.values())
		val = ''
		for i in d:
			if d[i] == mx:
				val = i
				break
		if val == 'R':
			val = 'P'
		elif val == 'S':
			val = 'R'
		else:
			val = 'S'
		ans = val * len(s)
	print(ans)


T = int(input())
t = 'RPSR'
for _ in range(T):
	a = input()
	l = []
	for i in range(3):
		l.append([a.count(t[i]), t[i + 1]])
	print(max(l)[1] * len(a))


for _ in range(int(input())):
	s = input()
	d = {'R': 0, 'S': 0, 'P': 0}
	for x in s:
		d[x] += 1
	m = max([d['R'], d['S'], d['P']])
	if d['R'] == m:
		print('P' * len(s))
	elif d['P'] == m:
		print('S' * len(s))
	else:
		print('R' * len(s))


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
q = ri()
for _ in range(q):
	sg = input()
	n = len(sg)
	ans = ''
	s = sg.count('S')
	r = sg.count('R')
	p = sg.count('P')
	if p == s and p == r:
		for l in sg:
			if l == 'R':
				ans += 'P'
			if l == 'P':
				ans += 'S'
			if l == 'S':
				ans += 'R'
	if p > s and p > r:
		ans = 'S' * n
	if r > s and r > p:
		ans = 'P' * n
	if s > r and s > p:
		ans = 'R' * n
	if p == s and p > r:
		for l in sg:
			if l == 'R':
				ans += 'R'
			if l == 'P':
				ans += 'S'
			if l == 'S':
				ans += 'R'
	if p == r and p > s:
		for l in sg:
			if l == 'R':
				ans += 'P'
			if l == 'P':
				ans += 'S'
			if l == 'S':
				ans += 'S'
	if r == s and r > p:
		for l in sg:
			if l == 'R':
				ans += 'P'
			if l == 'P':
				ans += 'P'
			if l == 'S':
				ans += 'R'
	print(ans)


from sys import stdin
input = lambda : stdin.readline().rstrip()
for _ in range(int(input())):
	s = input()
	n = len(s)
	S = R = P = 0
	for i in s:
		if i == 'S':
			S += 1
		elif i == 'R':
			R += 1
		else:
			P += 1
	k = max(S, R, P)
	if k == S:
		ans = 'R'
	elif k == R:
		ans = 'P'
	else:
		ans = 'S'
	print(ans * n)


t = int(input())
for _ in range(t):
	list1 = input().strip()
	r = list1.count('R')
	p = list1.count('P')
	s = list1.count('S')
	winner = max(r, p, s)
	if winner == r:
		choice = 'P'
	elif winner == p:
		choice = 'S'
	else:
		choice = 'R'
	for i in range(len(list1)):
		print(choice, end='')
	print()


from collections import Counter
n = int(input())
for i in range(n):
	s = input()
	bu = Counter(s)
	ma = max(bu, key=bu.get)
	if ma == 'R':
		gu = 'P'
	elif ma == 'S':
		gu = 'R'
	else:
		gu = 'S'
	for i in range(len(s)):
		print(gu, end='')
	print()


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	c = ''
	dic = {}
	for i in s:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
	m = 0
	x = ''
	for i in dic:
		if dic[i] > m:
			m = dic[i]
			x = i
	if x == 'R':
		c = 'P' * n
	if x == 'P':
		c = 'S' * n
	if x == 'S':
		c = 'R' * n
	print(c)


t = int(input())
for j in range(t):
	str = input()
	str = str.strip()
	cnt_R = cnt_P = cnt_S = 0
	for i in str:
		if i == 'R':
			cnt_R += 1
		elif i == 'P':
			cnt_P += 1
		elif i == 'S':
			cnt_S += 1
	if cnt_R >= cnt_P and cnt_R >= cnt_S:
		print('P' * len(str))
	elif cnt_P >= cnt_R and cnt_P >= cnt_S:
		print('S' * len(str))
	else:
		print('R' * len(str))


for _ in range(int(input())):
	stg = input()
	count = {'R': 0, 'S': 0, 'P': 0}
	for i in stg:
		count[i] += 1
	if count['R'] >= count['S'] and count['R'] >= count['P']:
		print('P' * len(stg))
	elif count['P'] >= count['S'] and count['P'] >= count['R']:
		print('S' * len(stg))
	else:
		print('R' * len(stg))


from collections import Counter
for _ in range(int(input())):
	s = list(input())
	c = Counter(s).most_common(1)[0][0]
	if c == 'R':
		print('P' * len(s))
	else:
		print('S' * len(s) if c == 'P' else 'R' * len(s))


from collections import Counter
from collections import OrderedDict

def SOCountR(mylist):
	return OrderedDict(sorted(Counter(mylist).items(), reverse=True))

def SOCount(mylist):
	return OrderedDict(sorted(Counter(mylist).items()))

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	st = input().rstrip('\n')
	st = list(st)
	ct = freq_count(st)
	if ct['R'] == ct['P'] and ct['P'] == ct['S']:
		for each in st:
			if each == 'R':
				print('P', end='')
			elif each == 'P':
				print('S', end='')
			else:
				print('R', end='')
		print()
	else:
		ct = dict(ct)
		mx = max(ct.values())
		for each in ct:
			if ct[each] == mx:
				maxa = each
		for each in st:
			if maxa == 'R':
				print('P', end='')
			elif maxa == 'P':
				print('S', end='')
			else:
				print('R', end='')
		print()


def find(s):
	from collections import defaultdict
	dic = defaultdict(int)
	for x in s:
		dic[x] += 1
	MAX = max([dic[x] for x in dic])
	ans = ''
	for x in dic:
		if dic[x] == MAX:
			ans = x
	if ans == 'R':
		return 'P'
	elif ans == 'P':
		return 'S'
	else:
		return 'R'
for _ in range(int(input())):
	s = input()
	ans = find(s)
	print(ans * len(s))


t = int(input())
for _ in range(t):
	s = str(input())
	out = [int(0) for _ in range(3)]
	for move in s:
		if move == 'R':
			out[0] += 1
		elif move == 'P':
			out[1] += 1
		else:
			out[2] += 1
	if out[0] >= max(out[1], out[2]):
		print('P' * len(s))
	elif out[1] >= max(out[0], out[2]):
		print('S' * len(s))
	else:
		print('R' * len(s))


(z, zz) = (input, lambda : list(map(int, z().split())))
mod = 10 ** 9 + 7
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0:
			return 0
	return 1
(z, zz) = (input, lambda : list(map(int, z().split())))
for _ in range(int(z())):
	l = z()
	y = len(l)
	ans = {'R': 'P', 'S': 'R', 'P': 'S'}
	gd = -74895
	for i in 'RPS':
		x = l.count(i)
		if x >= gd:
			t = i
			gd = x
	print(ans[t] * y)


for t in range(int(input())):
	S = input()
	n = len(S)
	r = S.count('R')
	p = S.count('P')
	s = S.count('S')
	mx = max(r, p, s)
	if r == mx:
		ans = 'P' * n
	elif p == mx:
		ans = 'S' * n
	else:
		ans = 'R' * n
	print(ans)


t = int(input())
while t > 0:
	s = str(input())
	R = s.count('R')
	P = s.count('P')
	S = s.count('S')
	A = max(R, P, S)
	n = len(s)
	if A == R:
		for i in range(n):
			print('P', end='')
	elif A == P:
		for j in range(n):
			print('S', end='')
	elif A == S:
		for k in range(n):
			print('R', end='')
	print('\t')
	t = t - 1


for _ in range(int(input())):
	st = input()
	res = ''
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	m = max(r, p, s)
	if m == r:
		for _ in range(len(st)):
			res += 'P'
	elif m == s:
		for _ in range(len(st)):
			res += 'R'
	else:
		for _ in range(len(st)):
			res += 'S'
	print(res)


for t in range(int(input())):
	a = input()
	arr = list(a)
	rc = arr.count('R')
	pc = arr.count('P')
	sc = arr.count('S')
	if max(rc, pc, sc) == rc:
		print('P' * len(arr))
	elif max(rc, pc, sc) == pc:
		print('S' * len(arr))
	else:
		print('R' * len(arr))


for _ in range(int(input())):
	s = input()
	a = {'R': 0, 'S': 0, 'P': 0}
	b = {'R': 'P', 'S': 'R', 'P': 'S'}
	for i in s:
		a[i] += 1
	val = max(a, key=a.get)
	print(b[val] * len(s))


from collections import Counter

def ans(S):
	freqs = Counter(S)
	arg_max = max(freqs, key=freqs.get)
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	return d[arg_max] * len(S)
T = int(input())
for t in range(T):
	S = input()
	print(ans(S))


(T,) = map(int, input().split())
import sys
input = sys.stdin.readline
from collections import defaultdict
for t in range(T):
	D = defaultdict(int)
	X = input().strip()
	for c in X:
		D[c] += 1
	(mx, mxi) = (0, 0)
	for c in 'RSP':
		if D[c] >= mx:
			mxi = c
			mx = D[c]
	if mxi == 'R':
		print('P' * len(X))
	elif mxi == 'S':
		print('R' * len(X))
	elif mxi == 'P':
		print('S' * len(X))


try:
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	for _ in range(int(input())):
		arr = list(map(str, input()))
		answer = []
		(count_R, count_P, count_S) = (0, 0, 0)
		for item in arr:
			if item == 'R':
				count_R += 1
			if item == 'S':
				count_S += 1
			if item == 'P':
				count_P += 1
			answer.append(d[item])
		if count_P != count_R or count_S != count_R or count_P != count_S:
			if max(count_P, count_R, count_S) == count_P:
				answer = ['S'] * len(arr)
			elif max(count_P, count_R, count_S) == count_R:
				answer = ['P'] * len(arr)
			else:
				answer = ['R'] * len(arr)
		print(''.join(answer))
except e:
	pass


for t in range(int(input())):
	s = input()
	arr = [0] * 3
	for i in s:
		if i == 'R':
			arr[0] += 1
		elif i == 'P':
			arr[1] += 1
		else:
			arr[2] += 1
	ind = arr.index(max(arr))
	if ind == 0:
		v = 'P'
	elif ind == 1:
		v = 'S'
	else:
		v = 'R'
	print(v * len(s))


for _ in range(int(input())):
	data = list(input())
	out = [0, 0, 0]
	for i in range(len(data)):
		if data[i] == 'R':
			out[0] += 1
		elif data[i] == 'P':
			out[1] += 1
		elif data[i] == 'S':
			out[2] += 1
	m = out.index(max(out))
	lett = 0
	if m == 0:
		lett = 'P'
	if m == 1:
		lett = 'S'
	if m == 2:
		lett = 'R'
	print(lett * len(data))


t = int(input())
for _ in range(t):
	s = input()
	ctr = s.count('R')
	cts = s.count('S')
	ctp = s.count('P')
	if max(ctr, ctp, cts) == ctr:
		print('P' * len(s))
	elif max(ctr, ctp, cts) == cts:
		print('R' * len(s))
	else:
		print('S' * len(s))


t = int(input())

def fun(n, a):
	s = {'R': 0, 'S': 0, 'P': 0}
	for i in range(n):
		s[a[i]] += 1
	ans = ''
	a = [s['R'], s['S'], s['P']]
	k = a.index(max(a))
	fi = ['P', 'R', 'S']
	ans = fi[k] * n
	print(ans)
while t:
	t -= 1
	a = input()
	n = len(a)
	fun(n, a)


def read_list():
	return list(map(int, input().split(' ')))

def print_list(l):
	print(' '.join(map(str, l)))

def judge():
	if dic[0] >= dic[1] and dic[0] >= dic[2]:
		return 'P'
	if dic[1] >= dic[0] and dic[1] >= dic[2]:
		return 'R'
	return 'S'
N = int(input())
for _ in range(N):
	s = input()
	dic = []
	dic.append(s.count('R'))
	dic.append(s.count('S'))
	dic.append(s.count('P'))
	print(judge() * len(s))


for _ in range(int(input())):
	a = input()
	n = len(a)
	rock = 0
	paper = 0
	scissor = 0
	for i in a:
		if i == 'S':
			rock += 1
		elif i == 'R':
			paper += 1
		else:
			scissor += 1
	val = max(rock, paper, scissor)
	if val == rock:
		ans = 'R' * n
	elif val == paper:
		ans = 'P' * n
	else:
		ans = 'S' * n
	print(ans)


import sys
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	string = list(input())
	n = len(string)
	r = string.count('R')
	p = string.count('P')
	s = string.count('S')
	if r >= max(p, s):
		print('P' * n)
	elif p >= max(r, s):
		print('S' * n)
	else:
		print('R' * n)


def optimizeWin(s):
	counter = {'R': 0, 'S': 0, 'P': 0}
	complement = {'R': 'P', 'P': 'S', 'S': 'R'}
	for i in s:
		counter[i] += 1
	botOpt = 'a'
	max = 0
	for i in counter:
		if counter[i] > max:
			max = counter[i]
			botOpt = i
	c = complement[botOpt] * len(s)
	return c
t = int(input())
for i in range(t):
	c = optimizeWin(input())
	print(c)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def main():
	try:
		l = list(input())
		(R, P, S) = (0, 0, 0)
		for x in l:
			if x == 'R':
				R += 1
			elif x == 'P':
				P += 1
			else:
				S += 1
		d = {}
		d['R'] = R
		d['S'] = S
		d['P'] = P
		t = max(R, S, P)
		for x in d:
			if d[x] == t:
				ans1 = x
				break
		n = len(l)
		if ans1 == 'R':
			ans = ['P'] * n
		elif ans1 == 'P':
			ans = ['S'] * n
		else:
			ans = ['R'] * n
		print(''.join(ans))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


for _ in range(int(input())):
	st = list(input())
	ans = ''
	n = len(st)
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	if max(r, s, p) == r:
		print('P' * n)
	elif max(r, s, p) == s:
		print('R' * n)
	else:
		print('S' * n)


t = int(input())
for tt in range(t):
	x = input()
	d = {}
	for i in range(len(x)):
		d[x[i]] = d.get(x[i], 0) + 1
	v = list(d.values())
	u = list(d.keys())
	k = u[v.index(max(v))]
	if k == 'R':
		print('P' * len(x))
	elif k == 'P':
		print('S' * len(x))
	else:
		print('R' * len(x))


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
sys.setrecursionlimit(10 ** 2)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def ri():
	return int(f.readline().strip())

def ria():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def rs():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque
import math
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def choose(n, k):
	if n < k:
		assert false
	return mult(factorial(n), modinv(mult(factorial(k), factorial(n - k)))) % NUMBER
from collections import deque, defaultdict
import heapq
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def dfs(g, timeIn, timeOut, depths, parents):
	cnt = 0
	stack = [[1, 0, 0, 0]]
	while stack:
		(v, neig_i, parent, depth) = stack[-1]
		parents[v] = parent
		depths[v] = depth
		if neig_i == 0:
			timeIn[v] = cnt
			cnt += 1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i += 1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u, 0, v, depth + 1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
cnt = 0

@bootstrap
def dfs(v, adj, timeIn, timeOut, depths, parents, parent=0, depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt += 1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u, adj, timeIn, timeOut, depths, parents, v, depth + 1)
	timeOut[v] = cnt
	cnt += 1
	yield

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def get_num_2_5(n):
	twos = 0
	fives = 0
	while n > 0 and n % 2 == 0:
		n //= 2
		twos += 1
	while n > 0 and n % 5 == 0:
		n //= 5
		fives += 1
	return (twos, fives)

def shift(a, i, num):
	for _ in range(num):
		(a[i], a[i + 1], a[i + 2]) = (a[i + 2], a[i], a[i + 1])

def equal(x, y):
	return abs(x - y) <= 1e-09

def getAngle(a, b, c):
	ang = math.degrees(math.atan2(c[1] - b[1], c[0] - b[0]) - math.atan2(a[1] - b[1], a[0] - b[0]))
	return ang + 360 if ang < 0 else ang

def getLength(a, b):
	return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
from heapq import heapify, heappush, heappop

def solution(s):
	(r, p, S) = (0, 0, 0)
	for x in s:
		if x == 'R':
			r += 1
		if x == 'P':
			p += 1
		if x == 'S':
			S += 1
	l = [r, S, p]
	if r == max(l):
		return 'P' * len(s)
	if S == max(l):
		return 'R' * len(s)
	return 'S' * len(s)

def main():
	T = 1
	T = ri()
	for i in range(T):
		s = rs()
		x = solution(s)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


t = int(input())
for i in range(t):
	bot = input()
	r = bot.count('R')
	p = bot.count('P')
	s = bot.count('S')
	if r >= p and r >= s:
		ans = 'P' * len(bot)
	if p >= r and p >= s:
		ans = 'S' * len(bot)
	if s >= r and s >= p:
		ans = 'R' * len(bot)
	print(ans)


for t in range(int(input())):
	s = input()
	d = {}
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	keylist = list(d.keys())
	vallist = list(d.values())
	m = 0
	for i in d:
		if m < d[i]:
			m = d[i]
	res = keylist[vallist.index(m)]
	if res == 'R':
		print('P' * len(s))
	elif res == 'S':
		print('R' * len(s))
	else:
		print('S' * len(s))


for _ in range(int(input())):
	l = list(input())
	a = l.count('R')
	b = l.count('S')
	c = l.count('P')
	m = max(a, max(b, c))
	if a == m:
		print(len(l) * 'P')
	elif b == m:
		print(len(l) * 'R')
	else:
		print(len(l) * 'S')


for _ in range(int(input())):
	a = input().strip()
	n = len(a)
	(r, p, s) = (a.count('R'), a.count('P'), a.count('S'))
	if r == 0 and p == 0:
		print('R' * n)
	elif p == 0 and s == 0:
		print('P' * n)
	elif s == 0 and r == 0:
		print('S' * n)
	elif r == p and p == s and (s == r):
		print('R' * n)
	elif r >= p and r >= s:
		print('P' * n)
	elif p >= r and p >= s:
		print('S' * n)
	elif s >= r and s >= p:
		print('R' * n)


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	st = inp()
	r = 0
	p = 0
	s = 0
	for i in st:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
		most = max(r, s, p)
	if r == p == s:
		print(st)
	elif r == most:
		a = ['P'] * len(st)
		print(''.join(a))
	elif p == most:
		a = ['S'] * len(st)
		print(''.join(a))
	else:
		a = ['R'] * len(st)
		print(''.join(a))


from collections import Counter

def func():
	freq = Counter(s)
	n = len(s)
	ch = max(freq, key=freq.get)
	if ch == 'R':
		ans = 'P' * n
	elif ch == 'P':
		ans = 'S' * n
	else:
		ans = 'R' * n
	print(ans)
for _ in range(int(input())):
	s = list(input())
	func()


a = int(input(''))
for i in range(0, a):
	b = input('')
	p = b.count('P')
	s = b.count('S')
	r = b.count('R')
	if r >= p and r >= s:
		print('P' * len(b))
	elif p >= r and p >= s:
		print('S' * len(b))
	else:
		print('R' * len(b))


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [(ch, len(list(g))) for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None
t = N()
for i in range(t):
	s = input()
	n = len(s)
	c = Counter(s)
	t = c.most_common(1)[0][0]
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(d[t] * n)


def solve():
	s = input()
	d = {'R': 0, 'S': 0, 'P': 0}
	for c in s:
		d[c] += 1
	m = max(d.values())
	print(len(s) * 'PRS'[[*d.values()].index(m)])

def main():
	for _ in range(int(input())):
		solve()
main()


import sys
all_data = sys.stdin.read().split('\n')
what_to_do = {'R': 'P', 'P': 'S', 'S': 'R'}
countdict = {}
for i in range(1, int(all_data[0]) + 1):
	countdict[str(all_data[i].count('R'))] = 'R'
	countdict[str(all_data[i].count('P'))] = 'P'
	countdict[str(all_data[i].count('S'))] = 'S'
	print(what_to_do[countdict[str(max(all_data[i].count('R'), all_data[i].count('S'), all_data[i].count('P')))]] * len(all_data[i]))


from collections import Counter
t = int(input())
for foo in range(t):
	s = input()
	cnt = Counter(s).most_common()
	mc = cnt[0][0]
	if mc == 'R':
		ans = 'P'
	elif mc == 'S':
		ans = 'R'
	elif mc == 'P':
		ans = 'S'
	print(ans * len(s))


t = int(input())
for _ in range(t):
	s = list(input())
	a = [s.count('R'), s.count('S'), s.count('P')]
	if a[0] == max(a):
		print('P' * len(s))
	elif a[1] == max(a):
		print('R' * len(s))
	else:
		print('S' * len(s))


for i in range(int(input())):
	s = input()
	n = len(s)
	(x, y, z) = (0, 0, 0)
	for i in range(n):
		if s[i] == 'R':
			y += 1
		elif s[i] == 'P':
			z += 1
		else:
			x += 1
	if y == max(x, y, z):
		for i in range(n):
			print('P', end='')
			y -= 1
	elif z == max(x, y, z):
		for i in range(n):
			print('S', end='')
			z -= 1
	elif x == max(x, y, z):
		for i in range(n):
			print('R', end='')
			x -= 1
	print()


t = int(input())
i = 0
while i < t:
	s = input('')
	n = len(s)
	rn = s.count('R')
	sn = s.count('S')
	pn = s.count('P')
	if max(rn, pn, sn) == rn:
		print(n * 'P')
	elif max(rn, pn, sn) == sn:
		print(n * 'R')
	elif max(rn, pn, sn) == pn:
		print(n * 'S')
	i += 1


for i in [*open(0)][1:]:
	l = [i.count('S'), i.count('P'), i.count('R')]
	print(['S', 'P', 'R'][l.index(max(l)) - 1] * (len(i) - 1))


for _ in range(int(input())):
	a = input()
	n = len(a)
	(R, P, S) = (a.count('R'), a.count('P'), a.count('S'))
	maxi = max(R, P, S)
	if S == maxi:
		print('R' * n)
	elif P == maxi:
		print('S' * n)
	else:
		print('P' * n)


n = int(input())
d = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(n):
	cnt = {'R': 0, 'P': 0, 'S': 0}
	s = input()
	for x in s:
		cnt[x] += 1
	for x in cnt.keys():
		if cnt[x] == max(cnt.values()):
			ans = x
	print(d[ans] * len(s))


t = int(input())
i = 0
while i < t:
	s = input()
	n = len(s)
	countp = 0
	countr = 0
	counts = 0
	for x in s:
		if x == 'P':
			countp = countp + 1
		if x == 'R':
			countr = countr + 1
		if x == 'S':
			counts = counts + 1
	res = [[countp, 'P'], [countr, 'R'], [counts, 'S']]
	res = sorted(res, key=lambda x: x[0], reverse=True)
	a = res[0][1]
	if a == 'P':
		print('S' * n)
	elif a == 'R':
		print('P' * n)
	else:
		print('R' * n)
	i = i + 1


from collections import defaultdict
t = int(input())
for test in range(t):
	s = input()
	d = dict()
	d['R'] = 'P'
	d['P'] = 'S'
	d['S'] = 'R'
	ct = defaultdict(int)
	for i in s:
		ct[i] += 1
	mx = 0
	for i in ct:
		if ct[i] > mx:
			mx = ct[i]
			ans = d[i]
	print(ans * len(s))


for _ in range(int(input())):
	s = input()
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(d[max('RSP', key=lambda x: s.count(x))] * len(s))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
T = int(input())
t = 'RPSR'
for _ in range(T):
	a = input()
	l = []
	for i in range(3):
		l.append([a.count(t[i]), t[i + 1]])
	print(max(l)[1] * len(a))


def solve():
	string = input()
	solution = {'R': 'P', 'S': 'R', 'P': 'S'}
	counts = {'R': 0, 'S': 0, 'P': 0}
	for c in string:
		if c == 'R':
			counts['R'] += 1
		if c == 'S':
			counts['S'] += 1
		if c == 'P':
			counts['P'] += 1
	mx_count = max(counts.values())
	max_char = 'R' if counts['R'] == mx_count else 'S' if counts['S'] == mx_count else 'P'
	print(solution[max_char] * len(string))
t = int(input())
while t != 0:
	t -= 1
	solve()


for nt in range(int(input())):
	string = input()
	n = len(string)
	(r, s, p) = (0, 0, 0)
	for i in string:
		if i == 'R':
			r += 1
		elif i == 'S':
			s += 1
		else:
			p += 1
	new = [[r, 'R'], [s, 'S'], [p, 'P']]
	new.sort()
	win = new[-1][1]
	if win == 'R':
		ans = 'P' * n
	elif win == 'P':
		ans = 'S' * n
	else:
		ans = 'R' * n
	print(ans)


tests = int(input())
for t in range(tests):
	string = input()
	roks = 0
	paper = 0
	scissor = 0
	for n in range(len(string)):
		if string[n] == 'R':
			roks += 1
		elif string[n] == 'P':
			paper += 1
		else:
			scissor += 1
	print_str = 'P' * (roks >= max(scissor, paper)) + 'S' * (paper > max(roks, scissor)) + 'R' * (scissor > max(roks, paper))
	if len(print_str) == 0:
		print_str = 'P' * (roks == paper > scissor) + 'R' * (roks == scissor > paper) + 'S' * (scissor == paper > roks)
	print(print_str * len(string))


import sys
import math
cases = int(input())
while cases > 0:
	s = input()
	(rc, pc, sc) = (0, 0, 0)
	for e in s:
		if e == 'S':
			sc += 1
		elif e == 'P':
			pc += 1
		else:
			rc += 1
	n = len(s)
	if rc >= pc and rc >= sc:
		ans = ''.join(['P' for e in range(n)])
	elif pc >= rc and pc >= sc:
		ans = ''.join(['S' for e in range(n)])
	else:
		ans = ''.join(['R' for e in range(n)])
	print(ans)
	cases -= 1


from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()
rli = lambda : map(int, stdin.readline().split())
rlf = lambda : map(float, stdin.readline().split())
(INF, NINF) = (float('inf'), float('-inf'))

def main():
	T = int(rl())
	for _ in range(T):
		s = rll()[0]
		n = len(s)
		F = Counter(s)
		x = sorted(F.keys(), key=lambda k: F[k], reverse=True)[0]
		if x == 'R':
			print('P' * n)
		elif x == 'S':
			print('R' * n)
		else:
			print('S' * n)
	stdout.close()
main()


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]
spf[0] = spf[1] = -1

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	s = list(input())
	x = [s.count('R'), s.count('P'), s.count('S')]
	idx = x.index(max(x))
	if idx == 0:
		print('P' * len(s))
	elif idx == 1:
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
for tt in range(t):
	s = input()
	n = len(s)
	foo = max(s.count('P'), s.count('R'), s.count('S'))
	if s.count('P') == foo:
		ans = 'S' * n
	elif s.count('R') == foo:
		ans = 'P' * n
	else:
		ans = 'R' * n
	print(ans)


d = {'S': 'R', 'P': 'S', 'R': 'P'}
for _ in range(int(input())):
	s = input()
	m = 0
	c = ''
	for i in d:
		x = s.count(i)
		if x >= m:
			m = x
			c = i
	ans = d[c] * len(s)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	a = input()
	t = {'R': 'P', 'P': 'S', 'S': 'R'}
	c = Counter(a).most_common()
	print(t[c[0][0]] * len(a))


t = int(input())
for _ in range(t):
	a = input()
	d = {'R': 0, 'S': 0, 'P': 0}
	for i in a:
		d[i] += 1
	if d['R'] >= d['S'] and d['S'] >= d['P'] or (d['R'] >= d['P'] and d['P'] >= d['S']):
		d['R'] = len(a)
		while d['R'] > 0:
			print('P', end='')
			d['R'] -= 1
	elif d['P'] >= d['R'] and d['R'] >= d['S'] or (d['P'] >= d['S'] and d['S'] >= d['R']):
		d['P'] = len(a)
		while d['P'] > 0:
			print('S', end='')
			d['P'] -= 1
	elif d['S'] >= d['R'] and d['R'] >= d['P'] or (d['S'] >= d['P'] and d['P'] >= d['R']):
		d['S'] = len(a)
		while d['S'] > 0:
			print('R', end='')
			d['S'] -= 1
	print()


tests = int(input())
for t in range(tests):
	input_str = input()
	res = ''
	count_r = 0
	count_s = 0
	count_p = 0
	for i in input_str:
		if i == 'R':
			count_r += 1
		if i == 'S':
			count_s += 1
		if i == 'P':
			count_p += 1
	if count_r >= count_s and count_r >= count_p:
		res = ['P' for i in range(len(input_str))]
	elif count_s >= count_r and count_s >= count_p:
		res = ['R' for i in range(len(input_str))]
	else:
		res = ['S' for i in range(len(input_str))]
	print(''.join(res))


t = int(input())
for k in range(t):
	s = input()
	hr = s.count('R')
	hp = s.count('P')
	hs = s.count('S')
	if hr == max(hr, hp, hs):
		print('P' * len(s))
	elif hp == max(hr, hp, hs):
		print('S' * len(s))
	else:
		print('R' * len(s))


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		st = input()
		s = 0
		r = 0
		p = 0
		for i in st:
			if i == 'R':
				r += 1
			if i == 'S':
				s += 1
			if i == 'P':
				p += 1
		ans = ''
		if s >= p and s >= r:
			ans = 'R'
		elif r >= s and r >= p:
			ans = 'P'
		else:
			ans = 'S'
		ans = ans * len(st)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin
input = stdin.readline
d = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(int(input())):
	s = input()[:-1]
	cnt = {}
	mx = 0
	for i in s:
		cnt[i] = cnt.get(i, 0) + 1
		if cnt[i] > mx:
			(mx, ans) = (cnt[i], i)
	print(d[ans] * len(s))


for _ in range(int(input())):
	s = input()
	L = len(s)
	count = [0] * 3
	for i in s:
		if i == 'R':
			count[0] += 1
		elif i == 'P':
			count[1] += 1
		else:
			count[2] += 1
	if count[0] == max(count):
		print('P' * L)
	elif count[1] == max(count):
		print('S' * L)
	else:
		print('R' * L)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	ans = ''
	d = {}
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	a = list(d.keys())
	move = a[0]
	for i in d:
		if d[i] > d[move]:
			move = i
	if move == 'R':
		move = 'P'
	elif move == 'P':
		move = 'S'
	else:
		move = 'R'
	ans = n * move
	print(ans)


def problemA():
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	while i < n - 1 and l[i] > l[i + 1]:
		i += 1
	if i == n - 1:
		print('NO')
		return
	j = i + 1
	while j < n - 1 and l[j] < l[j + 1]:
		j += 1
	if j == n - 1:
		print('NO')
		return
	print('YES')
	print(i + 1, j + 1, j + 2)

def problemB():
	s = input().strip()
	a = [0] * 3
	for i in s:
		if i == 'R':
			a[0] += 1
		elif i == 'S':
			a[1] += 1
		else:
			a[2] += 1
	m = max(a)
	if a[0] == m:
		print('P' * sum(a))
	elif a[1] == m:
		print('R' * sum(a))
	else:
		print('S' * sum(a))
cases = int(input())
for _ in range(cases):
	problemB()


n = int(input())
while n:
	s = input()
	R = 0
	P = 0
	S = 0
	for i in s:
		if i == 'R':
			R += 1
		elif i == 'P':
			P += 1
		else:
			S += 1
	if max(R, P, S) == R:
		for _ in range(len(s)):
			print('P', end='')
	elif max(R, P, S) == P:
		for _ in range(len(s)):
			print('S', end='')
	else:
		for _ in range(len(s)):
			print('R', end='')
	print('')
	n -= 1


from collections import Counter

def main():
	dict1 = {'R': 'P', 'S': 'R', 'P': 'S'}
	for _ in range(int(input())):
		str1 = input()
		count = Counter(str1).most_common(1)[0]
		print(dict1[count[0]] * len(str1))
main()


import sys
import math as mt
t = int(input())
for _ in range(t):
	s = input()
	d = {}
	d['R'] = 0
	d['S'] = 0
	d['P'] = 0
	for i in s:
		d[i] = d.get(i, 0) + 1
	ch = 'R'
	if d['R'] >= max(d['S'], d['P']):
		ch = 'P'
	if d['S'] >= max(d['R'], d['P']):
		ch = 'R'
	if d['P'] >= max(d['S'], d['R']):
		ch = 'S'
	for i in range(len(s)):
		print(ch, end='')
	print()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	st = input().strip()
	n = len(st)
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	if r <= s >= p:
		print(n * 'R')
	elif s <= p >= r:
		print(n * 'S')
	else:
		print(n * 'P')


for _ in range(int(input())):
	a = list(input())
	str1 = ''
	r = 0
	p = 0
	s = 0
	d = {}
	for i in a:
		if i == 'R':
			r = r + 1
		elif i == 'P':
			p = p + 1
		else:
			s = s + 1
	if max(r, p, s) == r:
		str1 = 'P' * len(a)
	elif max(r, p, s) == p:
		str1 = 'S' * len(a)
	else:
		str1 = 'R' * len(a)
	print(str1)


def solution():
	for _ in range(int(input())):
		s = input()
		ans = ''
		r = 0
		p = 0
		sc = 0
		for i in s:
			if i == 'S':
				sc += 1
			elif i == 'P':
				p += 1
			else:
				r += 1
		if max([r, sc, p]) == r:
			ans = 'P' * len(s)
		elif max([r, sc, p]) == p:
			ans = 'S' * len(s)
		else:
			ans = 'R' * len(s)
		print(ans)
solution()


t = int(input())
for _ in range(t):
	a = input()
	counts = {'R': 0, 'S': 0, 'P': 0}
	wins = {'R': 'P', 'S': 'R', 'P': 'S'}
	for i in a:
		counts[i] += 1
	print(wins[max(counts.items(), key=lambda x: x[1])[0]] * len(a))


for _ in range(int(input())):
	s = input()
	n = len(s)
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	freq = {}
	for i in s:
		freq[i] = freq.get(i, 0) + 1
	maxx = max(freq, key=freq.get)
	ans = d[maxx] * n
	print(ans)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	bot = string()
	RPS = {'rock': 0, 'paper': 0, 'scissor': 0}
	choose = {'rock': 'P', 'paper': 'S', 'scissor': 'R'}
	for x in bot:
		if x == 'R':
			RPS['rock'] += 1
		elif x == 'P':
			RPS['paper'] += 1
		else:
			RPS['scissor'] += 1
	val = max(RPS.values())
	for x in RPS:
		if RPS[x] == val:
			req = x
			break
	print(choose[req] * len(bot))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(scanner()):
	solve()


for _ in range(int(input())):
	ss = input()
	count = {}
	for e in ss:
		if e not in count:
			count[e] = 1
		else:
			count[e] += 1
	s = 0
	d = 'R'
	for (e, f) in count.items():
		if f > s:
			s = f
			d = e
	if d == 'R':
		ans = 'P' * len(ss)
	elif d == 'S':
		ans = 'R' * len(ss)
	else:
		ans = 'S' * len(ss)
	print(ans)


for _ in range(int(input())):
	string = input()
	(r, p, s) = (0, 0, 0)
	for i in string:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
	ar = [r, p, s]
	max_in = None
	max_no = 0
	for (i, j) in enumerate(ar):
		if j >= max_no:
			max_no = j
			max_in = i
	length = len(string)
	if max_in == 0:
		print('P' * length)
	elif max_in == 1:
		print('S' * length)
	else:
		print('R' * length)


for _ in range(int(input())):
	ans = {}
	lst = input()
	for i in lst:
		if i not in ans:
			ans[i] = 1
		else:
			ans[i] += 1
	count = 0
	for i in ans:
		if ans[i] > count:
			count = ans[i]
			final = i
	if final == 'R':
		final = 'P'
	elif final == 'S':
		final = 'R'
	else:
		final = 'S'
	print(final * len(lst))


import sys
from collections import Counter
n = int(sys.stdin.readline().strip())
for i in range(n):
	m = sys.stdin.readline().strip()
	x = Counter(m)
	R = x['R']
	S = x['S']
	P = x['P']
	if R >= S and R >= P:
		print('P' * len(m))
	elif S >= R and S >= P:
		print('R' * len(m))
	elif P >= S and P >= R:
		print('S' * len(m))


def in1():
	return int(input())
for _ in range(in1()):
	s = list(input())
	d = [0, 0, 0]
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			d[0] += 1
		elif s[i] == 'S':
			d[1] += 1
		else:
			d[2] += 1
	s1 = ''
	t1 = max(d)
	t2 = d.index(t1)
	if t2 == 0:
		s1 = 'P' * len(s)
	elif t2 == 1:
		s1 = 'R' * len(s)
	else:
		s1 = 'S' * len(s)
	print(s1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
for _ in range(int(input())):
	c = {'R': 'P', 'P': 'S', 'S': 'R'}
	s = input()
	d = Counter(list(s))
	m = 0
	for i in d:
		if d[i] > m:
			ans = i
		m = max(m, d[i])
	print(c[ans] * len(s))


t = int(input())
for u in range(t):
	a = input()
	r = 0
	p = 0
	s = 0
	for x in a:
		if x == 'R':
			r += 1
		if x == 'S':
			s += 1
		if x == 'P':
			p += 1
	t = max(r, s, p)
	if t == r:
		otv = 'P' * len(a)
	elif t == s:
		otv = 'R' * len(a)
	else:
		otv = 'S' * len(a)
	print(otv)


t = int(input())
for i in range(t):
	ch = input()
	n = len(ch)
	nbR = ch.count('R')
	nbS = ch.count('S')
	nbP = ch.count('P')
	L = [nbR, nbS, nbP]
	if nbR == max(L):
		print('P' * n)
	elif nbS == max(L):
		print('R' * n)
	else:
		print('S' * n)


for kek in range(int(input())):
	x = input()
	R = 0
	S = 0
	P = 0
	for i in x:
		if i == 'R':
			R += 1
		if i == 'S':
			S += 1
		if i == 'P':
			P += 1
	ans = ''
	if max(S, R, P) == P:
		ans = 'S'
	elif max(S, R, P) == S:
		ans = 'R'
	else:
		ans = 'P'
	print(ans * len(x))


from sys import stdin, stdout
import sys
INF = 100000000000.0
import bisect

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
from collections import defaultdict
import math
for t in range(int(stdin.readline())):
	s = get_string()
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	mx = -1
	ch = 'R'
	for i in d:
		if d[i] > mx:
			mx = d[i]
			ch = i
	if ch == 'R':
		ans = 'P' * len(s)
	elif ch == 'P':
		ans = 'S' * len(s)
	elif ch == 'S':
		ans = 'R' * len(s)
	print(ans)


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
from heapq import heapify, heappop, heappush, heapreplace, heappushpop

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline().rstrip()

def lsi():
	return list(si())
res = ['YES', 'NO']

def solve():
	a = lsi()
	r = p = s = 0
	for i in a:
		if i == 'R':
			r += 1
		elif i == 'S':
			s += 1
		else:
			p += 1
	if s <= p >= r:
		ans = 'S'
	elif p <= s >= r:
		ans = 'R'
	else:
		ans = 'P'
	print(ans * len(a))
	return
d = ['P', 'S', 'R']
test_case = ii()
while test_case:
	test_case -= 1
	solve()


t = int(input())
for _ in range(t):
	s = input()
	p = 0
	r = 0
	si = 0
	for i in range(len(s)):
		if s[i] == 'P':
			p = p + 1
		elif s[i] == 'R':
			r = r + 1
		else:
			si = si + 1
	mx = max(max(p, r), si)
	if mx == p:
		print('S' * len(s))
	elif mx == si:
		print('R' * len(s))
	else:
		print('P' * len(s))


for i in range(int(input())):
	s = input()
	countR = 0
	countS = 0
	countP = 0
	for j in s:
		if j == 'R':
			countP += 1
		elif j == 'S':
			countR += 1
		else:
			countS += 1
	if countP == max(countR, countS, countP):
		print('P' * len(s))
	elif countR == max(countR, countS, countP):
		print('R' * len(s))
	else:
		print('S' * len(s))


from collections import Counter
t = int(input())
for testcase in range(t):
	s = input()
	x = Counter(s).most_common(1)[0][0]
	moves = ['R', 'P', 'S']
	print(moves[(moves.index(x) + 1) % 3] * len(s))


from collections import Counter
for _ in range(int(input())):
	di = {'R': 'P', 'P': 'S', 'S': 'R'}
	a = input()
	g = Counter(a).most_common()[0][0]
	print(di[g] * len(a))


t = int(input())
while t:
	t -= 1
	a = list(input())
	prs = [0, 0, 0]
	for i in a:
		if i == 'P':
			prs[0] += 1
		elif i == 'R':
			prs[1] += 1
		elif i == 'S':
			prs[2] += 1
	if prs[0] >= prs[1] and prs[0] >= prs[2]:
		ans = 'S'
	elif prs[1] >= prs[0] and prs[1] >= prs[2]:
		ans = 'P'
	else:
		ans = 'R'
	for i in range(len(a)):
		print(ans, end='')
	print()


n = int(input())
while n > 0:
	n -= 1
	s = input()
	l = len(s)
	r = sc = p = 0
	r = s.count('R')
	sc = s.count('S')
	p = s.count('P')
	if r >= sc and r >= p:
		print('P' * l)
	elif p >= sc and p >= r:
		print('S' * l)
	else:
		print('R' * l)


import os
import operator
import sys
from io import BytesIO, IOBase

def inar():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		st = input()
		n = len(st)
		res = ''
		res = [[0, 'R'], [0, 'P'], [0, 'S']]
		for i in range(len(st)):
			if st[i] == 'R':
				res[0][0] += 1
			elif st[i] == 'S':
				res[2][0] += 1
			else:
				res[1][0] += 1
		res.sort(reverse=True)
		de = res[0][1]
		if de == 'R':
			winner = 'P'
		if de == 'P':
			winner = 'S'
		if de == 'S':
			winner = 'R'
		print(winner * n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	s = list(input())
	d = {}
	for i in range(len(s)):
		if s[i] not in d:
			d[s[i]] = 0
		d[s[i]] += 1
	mx = 0
	for i in d:
		if d[i] > mx:
			mx = d[i]
			ind = i
	if ind == 'R':
		sol = len(s) * ['P']
	elif ind == 'P':
		sol = len(s) * ['S']
	elif ind == 'S':
		sol = len(s) * ['R']
	print(*sol, sep='')


from sys import stdin, stdout
import math
input = stdin.readline

def print(x='', y='', end='\n'):
	if y == '':
		stdout.write(str(x) + end)
	else:
		stdout.write(str(x) + ' ' + str(y) + end)

def solve():
	s = list(input())[:-1]
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	ans = []
	cnt = {}
	for i in s:
		if i in cnt:
			cnt[i] += 1
		else:
			cnt[i] = 1
	maxx = ''
	cnm = 0
	for i in cnt:
		if cnt[i] > cnm:
			cnm = cnt[i]
			maxx = i
	print(str(d[maxx]) * len(s))
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


t = int(input())
for _ in range(t):
	st = input().strip()
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	if max(r, s, p) == r:
		print('P' * len(st))
	elif max(r, s, p) == s:
		print('R' * len(st))
	else:
		print('S' * len(st))


t = int(input())
cases = []
for _ in range(t):
	cases.append(list(input()))
for c in cases:
	m = {'R': 0, 'P': 0, 'S': 0}
	for i in range(len(c)):
		m[c[i]] += 1
	maxi = max(m, key=m.get)
	if maxi == 'R':
		print('P' * len(c))
	elif maxi == 'P':
		print('S' * len(c))
	else:
		print('R' * len(c))


from sys import *
input = stdin.readline
t = int(input())
for _ in range(t):
	st = input()
	n = len(st)
	r = 0
	p = 0
	s = 0
	for i in st:
		if i == 'R':
			r += 1
		elif i == 'S':
			s += 1
		elif i == 'P':
			p += 1
	m = max(r, p, s)
	n -= 1
	if m == r:
		res = 'P' * n
	elif m == s:
		res = 'R' * n
	elif m == p:
		res = 'S' * n
	print(res)


import math
t = int(input())
for g in range(0, t):
	string = input()
	p = 0
	r = 0
	s = 0
	for i in range(0, len(string)):
		if string[i] == 'P':
			p += 1
		elif string[i] == 'R':
			r += 1
		else:
			s += 1
	if r >= p and r >= s:
		ans = 'P' * len(string)
		print(ans)
	elif p >= r and p >= s:
		ans = 'S' * len(string)
		print(ans)
	else:
		ans = 'R' * len(string)
		print(ans)


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')
tests = lambda : range(1, int_in() + 1)
case_out = lambda i, o: out('Case #{}: {}'.format(i, o))
from collections import defaultdict

def solve(s):
	count = defaultdict(lambda : 0)
	for char in s:
		count[char] += 1
	if count['R'] >= count['S'] and count['R'] >= count['P']:
		return 'P' * len(s)
	if count['S'] >= count['R'] and count['S'] >= count['P']:
		return 'R' * len(s)
	return 'S' * len(s)
for _ in tests():
	s = str_in()
	out(solve(s))


k = int(input())
for c in range(k):
	l = [i for i in input()]
	total = {'R': 0, 'P': 0, 'S': 0}
	for i in l:
		total[i] += 1
	mais_aparece = max(total, key=total.get)
	otimo = {'R': 'P', 'P': 'S', 'S': 'R'}
	resposta = ''.join([otimo[mais_aparece]] * len(l))
	print(resposta)


for _ in range(int(input())):
	a = input()
	n = len(a)
	x = a.count('R')
	y = a.count('S')
	z = a.count('P')
	if x == y == z:
		print(''.join(a), end='')
	elif max(x, y, z) == x:
		for i in range(n):
			print('P', end='')
	elif max(x, y, z) == y:
		for i in range(n):
			print('R', end='')
	elif max(x, y, z) == z:
		for i in range(n):
			print('S', end='')
	print()


from collections import Counter
t = int(input())
for _ in range(t):
	s = list(input())
	d = Counter(s).most_common()
	if d[0][0] == 'R':
		print('P' * len(s))
	elif d[0][0] == 'P':
		print('S' * len(s))
	else:
		print('R' * len(s))


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	s = sys.stdin.readline().strip()
	(x, y, z) = (s.count('R'), s.count('S'), s.count('P'))
	if max(x, y, z) == x:
		print('P' * len(s))
	elif max(x, y, z) == y:
		print('R' * len(s))
	else:
		print('S' * len(s))


def rsp(string):
	maxi = max(string.count('R'), string.count('S'), string.count('P'))
	if string.count('R') == string.count('S') == string.count('P'):
		return string
	elif maxi == string.count('R'):
		return 'P' * len(string)
	elif maxi == string.count('P'):
		return 'S' * len(string)
	elif maxi == string.count('S'):
		return 'R' * len(string)
t = int(input())
for u in range(t):
	print(rsp(input()))


import math as mt

def tran(s):
	(r, ss, p) = (s.count('R'), s.count('S'), s.count('P'))
	a = ''
	if s.count(s[0]) == len(s):
		if s[0] == 'R':
			a = 'P'
			a = a * len(s)
			return a
		elif s[0] == 'P':
			a = 'S'
			a = a * len(s)
			return a
		elif s[0] == 'S':
			a = 'R'
			a = a * len(s)
			return a
	else:
		data = {ss: 'S', r: 'R', p: 'P'}
		i = max(r, ss, p)
		if data[i] == 'P':
			oo = 'S'
		elif data[i] == 'R':
			oo = 'P'
		else:
			oo = 'R'
		return oo * len(s)
t = int(input())
ans = []
for i in range(t):
	s = input()
	res = tran(s)
	ans.append(res)
for i in ans:
	print(i)


import sys, io, os, time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for ii in range(int(input())):
	s = input()
	n = len(s)
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	count = defaultdict(int)
	for i in s:
		count[i] += 1
	count = sorted(count.items(), key=lambda x: x[1], reverse=True)
	c = count[0][0]
	print(win[c] * n)


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	d = Counter(s)
	maxx = -1
	ans = ''
	for i in d:
		maxx = max(maxx, d[i])
	for i in d:
		if d[i] == maxx:
			ans = i
	if ans == 'P':
		ans = 'S'
	elif ans == 'R':
		ans = 'P'
	else:
		ans = 'R'
	print(ans * len(s))


def solve():
	ss = input()
	d = {}
	d['R'] = 0
	d['P'] = 0
	d['S'] = 0
	for i in ss:
		d[i] += 1
	(r, p, s) = (d['R'], d['P'], d['S'])
	e = max(r, max(p, s))
	if e == r:
		print('P' * len(ss))
	elif e == p:
		print('S' * len(ss))
	else:
		print('R' * len(ss))
for _ in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	inputstr = input()
	output = ''
	count = {}
	for i in inputstr:
		if i not in count:
			count[i] = 1
		else:
			count[i] += 1
	dict2 = {'R': 'P', 'P': 'S', 'S': 'R'}
	output = dict2[max(count, key=lambda i: count[i])] * len(inputstr)
	print(output)


t = int(input())
for _ in range(t):
	s = str(input())
	n = len(s)
	a = {'R', 'P', 'S'}
	r = s.count('R')
	p = s.count('P')
	s = s.count('S')
	if r == max(r, p, s):
		ans = n * 'P'
	elif p == max(r, p, s):
		ans = n * 'S'
	else:
		ans = n * 'R'
	print(ans)


for _ in range(int(input())):
	s = input()
	d = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		if i in d:
			d[i] = d[i] + 1
	if d['P'] >= d['R'] and d['P'] >= d['S']:
		print('S' * len(s))
		continue
	if d['S'] >= d['R'] and d['S'] >= d['P']:
		print('R' * len(s))
		continue
	if d['R'] >= d['P'] and d['R'] >= d['S']:
		print('P' * len(s))
		continue


from sys import *
t = int(stdin.readline())
while t > 0:
	s = stdin.readline()
	d = dict()
	for i in range(len(s)):
		if s[i] not in d:
			d[s[i]] = 1
		else:
			d[s[i]] += 1
	dk = max(d, key=d.get)
	if dk == 'R':
		ans = 'P'
	if dk == 'P':
		ans = 'S'
	if dk == 'S':
		ans = 'R'
	l = [ans for i in range(len(s) - 1)]
	print(''.join(l))
	t -= 1


from collections import Counter
n = int(input())
vet = []
for _ in range(n):
	inp = input()
	res = Counter(inp)
	aux = res.most_common()
	if aux[0][0] == 'P':
		vet.append('S' * len(inp))
	elif aux[0][0] == 'R':
		vet.append('P' * len(inp))
	elif aux[0][0] == 'S':
		vet.append('R' * len(inp))
print(*vet, sep='\n')


for _ in range(int(input())):
	s = input()
	opp = {'R': 'P', 'S': 'R', 'P': 'S'}
	counts = {'R': 0, 'S': 0, 'P': 0}
	(hi, bestC) = (0, 'R')
	for c in s:
		counts[c] += 1
		if counts[c] > hi:
			hi = counts[c]
			bestC = c
	print(opp[bestC] * len(s))


from sys import stdin, stdout
import math, queue, heapq
fastinput = stdin.readline
fastout = stdout.write
t = int(fastinput())
while t:
	t -= 1
	s = input()
	rock = s.count('R')
	scisoor = s.count('S')
	paper = s.count('P')
	x = ''
	if rock >= scisoor and rock >= paper:
		x += 'P' * len(s)
	elif paper >= scisoor and paper >= rock:
		x += 'S' * len(s)
	else:
		x += 'R' * len(s)
	print(x)


tc = int(input())
for _ in range(tc):
	str1 = input()
	dic = {}
	for c in str1:
		if c not in dic:
			dic[c] = 1
			continue
		dic[c] += 1
	keys = list(dic.keys())
	values = list(dic.values())
	ma = index = 0
	for i in range(len(values)):
		if values[i] > ma:
			ma = values[i]
			index = i
	ans = ''
	x = {'R': 'P', 'S': 'R', 'P': 'S'}
	for i in range(len(str1)):
		ans += x[keys[index]]
	print(ans)


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n
avl = AvlTree()

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	s = input()
	e = [0, 0, 0]
	e[0] = s.count('R')
	e[1] = s.count('S')
	e[2] = s.count('P')
	r = e.index(max(e))
	ans = ['P', 'R', 'S']
	print(ans[r] * len(s))


from collections import defaultdict
for _ in range(int(input())):
	s = input()
	ctr = defaultdict(int)
	for c in s:
		ctr[c] += 1
	vals = [t[1] for t in ctr.items()]
	if ctr['R'] == max(vals):
		print('P' * len(s))
	elif ctr['P'] == max(vals):
		print('S' * len(s))
	else:
		print('R' * len(s))


from collections import Counter
for _ in range(int(input())):
	s = input()
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	a = Counter(s).most_common(1)[0][0]
	ans = win[a] * len(s)
	print(ans)


for _ in range(int(input())):
	s = input()
	a = [0] * 3
	for item in s:
		if item == 'R':
			a[0] += 1
		elif item == 'P':
			a[1] += 1
		else:
			a[2] += 1
	if max(a) == a[0]:
		print('P' * len(s))
	elif max(a) == a[1]:
		print('S' * len(s))
	else:
		print('R' * len(s))


for _ in range(int(input())):
	str = input()
	rock = 0
	sci = 0
	paper = 0
	for i in str:
		if i == 'R':
			rock += 1
		elif i == 'S':
			sci += 1
		elif i == 'P':
			paper += 1
	d = max(rock, sci)
	e = max(d, paper)
	if e == rock:
		print('P' * len(str))
	elif e == sci:
		print('R' * len(str))
	elif e == paper:
		print('S' * len(str))


t = int(input())
for x in range(t):
	s = list(input())
	rocks = s.count('R')
	scissors = s.count('S')
	paper = s.count('P')
	if rocks == scissors and paper == scissors:
		print(''.join(s))
	elif rocks == max(scissors, paper, rocks):
		print('P' * len(s))
	elif paper == max(scissors, paper, rocks):
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
ans = []
for i in range(t):
	s = input()
	c = dict()
	k = 0
	c['R'] = 0
	c['P'] = 0
	c['S'] = 0
	for j in s:
		c[j] += 1
	for j in c:
		k = max(k, c[j])
	if c['R'] == k:
		ans.append('P' * len(s))
	elif c['P'] == k:
		ans.append('S' * len(s))
	else:
		ans.append('R' * len(s))
for i in ans:
	print(i)


I = input
for _ in range(int(I())):
	s = list(I())
	d = dict()
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	m = 0
	c = ''
	for i in d:
		if d[i] > m:
			m = d[i]
			c = i
	d1 = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(d1[c] * len(s))


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter

def main():
	for _ in range(int(input())):
		arr = input()
		n = len(arr)
		c1 = c2 = c3 = 0
		for ch in arr:
			if ch == 'R':
				c1 += 1
			elif ch == 'P':
				c2 += 1
			else:
				c3 += 1
		if c1 > max(c2, c3):
			print('P' * n)
		elif c2 > c3:
			print('S' * n)
		else:
			print('R' * n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	s = input()
	cR = 0
	cS = 0
	cP = 0
	for i in range(len(s)):
		if s[i] == 'R':
			cR += 1
		elif s[i] == 'S':
			cS += 1
		else:
			cP += 1
	val = ''
	if cR >= cS and cR >= cP:
		val = 'P'
	elif cS >= cR and cS >= cP:
		val = 'R'
	else:
		val = 'S'
	for i in range(len(s)):
		print(val, end='')
	print('\n', end='')


t = int(input())
for i in range(t):
	k = input()
	p = k.count('P')
	r = k.count('R')
	s = k.count('S')
	c = max(p, r, s)
	if p == c:
		print('S' * len(k))
	elif r == c:
		print('P' * len(k))
	else:
		print('R' * len(k))


n = int(input())
for _ in range(0, n):
	a = input()
	x = len(a)
	p = 0
	r = 0
	s = 0
	for i in range(0, len(a)):
		if a[i] == 'R':
			r += 1
		if a[i] == 'P':
			p += 1
		if a[i] == 'S':
			s += 1
	if p >= s and p >= r:
		while x:
			print('S', end='')
			x -= 1
	elif s >= p and s >= r:
		while x:
			print('R', end='')
			x -= 1
	elif r >= p and r >= s:
		while x:
			print('P', end='')
			x -= 1
	print()


for z in range(int(input())):
	s = input()
	d = {'R': 0, 'P': 0, 'S': 0}
	for c in s:
		d[c] += 1
	mc = max(d, key=d.get)
	print({'R': 'P', 'P': 'S', 'S': 'R'}[mc] * len(s))


for _ in range(int(input())):
	a = input()
	n = len(a)
	(r, p, s) = (a.count('R'), a.count('P'), a.count('S'))
	q = max(r, s, p)
	if s == q:
		print('R' * n)
	elif p == q:
		print('S' * n)
	else:
		print('P' * n)


t = int(input())
ans = [None for _ in range(t)]
for q in range(t):
	s = input()
	(P, S, R) = (0, 0, 0)
	for i in range(len(s)):
		if s[i] == 'P':
			P += 1
		elif s[i] == 'S':
			S += 1
		else:
			R += 1
	if S == P == R:
		ans[q] = 'P' * R + 'S' * P + 'R' * S
	elif max(P, S, R) == P:
		ans[q] = 'S' * len(s)
	elif max(P, S, R) == R:
		ans[q] = 'P' * len(s)
	else:
		ans[q] = 'R' * len(s)
for i in range(t):
	print(ans[i])


from collections import Counter
for _ in range(int(input())):
	S = input()
	n = len(S)
	C = Counter(S)
	c = C.most_common(1)[0][0]
	if c == 'R':
		print('P' * n)
	elif c == 'P':
		print('S' * n)
	else:
		print('R' * n)


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	choices = Counter(s)
	mode = choices.most_common(1)[0][0]
	if mode == 'R':
		print('P' * len(s))
	elif mode == 'P':
		print('S' * len(s))
	elif mode == 'S':
		print('R' * len(s))


import collections
for _ in range(int(input())):
	s = input()
	a = collections.Counter(s).most_common(1)[0]
	d = a[0] * len(s)
	if d[0] == 'R':
		print(len(d) * 'P')
	if d[0] == 'P':
		print(len(d) * 'S')
	if d[0] == 'S':
		print(len(d) * 'R')


import sys
input = sys.stdin.readline

def rps(arr):
	r = 0
	p = 0
	s = 0
	for ele in arr:
		if ele == 'R':
			r += 1
		elif ele == 'P':
			p += 1
		else:
			s += 1
	m = max(r, p, s)
	if m == r:
		return 'P' * (len(arr) - 1)
	elif m == p:
		return 'S' * (len(arr) - 1)
	else:
		return 'R' * (len(arr) - 1)

def solution():
	arr = list(input())
	print(rps(arr))
t = int(input())
for i in range(0, t):
	solution()


T = int(input())
for _ in range(T):
	s = input().strip()
	rc = 0
	sc = 0
	pc = 0
	for c in s:
		if c == 'R':
			rc += 1
		elif c == 'S':
			sc += 1
		else:
			pc += 1
	if rc == max(rc, sc, pc):
		print('P' * len(s))
	elif sc == max(rc, sc, pc):
		print('R' * len(s))
	else:
		print('S' * len(s))


for _ in range(int(input())):
	s = list(input())
	r = {}
	m = -1
	ans = ''
	for i in s:
		r[i] = r.get(i, 0) + 1
		if r[i] > m:
			m = r[i]
			ans = i
	if ans == 'S':
		ans = 'R'
	elif ans == 'R':
		ans = 'P'
	else:
		ans = 'S'
	print(ans * len(s))


import sys
input = sys.stdin.readline
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
SI = lambda : input().strip('\n')
II = lambda : int(input())
res = []
for _ in range(II()):
	(r, s, p) = (0, 0, 0)
	S = SI()
	n = len(S)
	for c in S:
		if c == 'R':
			r += 1
		elif c == 'S':
			s += 1
		else:
			p += 1
	num = {}
	num['RSP'] = s + r + p
	num['RRS'] = s * 2 + p
	num['SSR'] = p * 2 + s
	num['RRP'] = s * 2 + r
	num['PPR'] = r * 2 + s
	num['PPS'] = r * 2 + p
	num['SSP'] = p * 2 + r
	num['PPP'] = r * 3
	num['RRR'] = s * 3
	num['SSS'] = p * 3
	out = max(num.keys(), key=lambda x: num[x])
	if out == 'RSP':
		ans = S
	elif out == 'RRS':
		ans = 'S' * p + (n - p) * 'R'
	elif out == 'SSR':
		ans = 'R' * s + (n - s) * 'S'
	elif out == 'RRP':
		ans = 'P' * r + (n - r) * 'R'
	elif out == 'PPR':
		ans = 'R' * s + (n - s) * 'P'
	elif out == 'PPS':
		ans = 'S' * p + (n - p) * 'P'
	elif out == 'SSP':
		ans = 'P' * r + (n - r) * 'S'
	elif out == 'RRR':
		ans = 'R' * n
	elif out == 'PPP':
		ans = 'P' * n
	else:
		ans = 'S' * n
	res.append(ans)
print(*res)


from sys import stdin
for _ in range(int(input())):
	s = input()
	a = b = c = 0
	for i in range(len(s)):
		if s[i] == 'R':
			a += 1
		elif s[i] == 'P':
			b += 1
		else:
			c += 1
	if a == max([a, b, c]):
		print('P' * len(s))
	elif b == max([a, b, c]):
		print('S' * len(s))
	else:
		print('R' * len(s))


from collections import Counter
for _ in range(int(input())):
	s = input()
	t = ''
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	c = Counter(list(s))
	x = c.most_common()[0][0]
	t = d[x] * len(s)
	print(t)


t = int(input())
for i in range(t):
	s = input()
	a = s.count('R')
	b = s.count('S')
	c = s.count('P')
	if a == b == c:
		print(s)
		continue
	if a == max(a, b, c):
		c1 = 'P'
	elif b == max(a, b, c):
		c1 = 'R'
	else:
		c1 = 'S'
	print(c1 * len(s))


for _ in range(int(input())):
	s = input()
	tmp = {s.count('S'): 'S', s.count('P'): 'P', s.count('R'): 'R'}
	tmp = tmp[max(tmp)]
	ans = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(ans[tmp] * len(s))


for t in range(int(input())):
	s = input()
	l = [0] * 3
	n = len(s)
	for z in range(n):
		if s[z] == 'R':
			l[0] += 1
		elif s[z] == 'P':
			l[1] += 1
		else:
			l[-1] += 1
	idx = l.index(max(l))
	if idx == 0:
		ans = ['P'] * n
	elif idx == 1:
		ans = ['S'] * n
	else:
		ans = ['R'] * n
	print(''.join(ans))


T = int(input())
while T > 0:
	s = input()
	dic = {'R': 0, 'S': 1, 'P': 2}
	count = [0] * 3
	for i in range(len(s)):
		count[dic[s[i]]] += 1
	x = 0
	index = 0
	for i in range(3):
		if count[i] > x:
			x = count[i]
			index = i
	if index == 0:
		print('P' * len(s))
	elif index == 1:
		print('R' * len(s))
	else:
		print('S' * len(s))
	T -= 1


from sys import stdin, stdout
T = int(stdin.readline())
for iT in range(T):
	s = stdin.readline().strip()
	k = {i: 0 for i in 'RSP'}
	for i in s:
		k[i] += 1
	stdout.write(f"{ {'R': 'P', 'P': 'S', 'S': 'R'}[max(k, key=k.get)] * len(s)}\n")


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		s = si()
		n = len(s)
		x = s.count('R')
		y = s.count('S')
		z = s.count('P')
		if max(x, y, z) == x:
			print('P' * n)
		elif max(x, y, z) == y:
			print('R' * n)
		elif max(x, y, z) == z:
			print('S' * n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout

def INPUT():
	return list((int(i) for i in stdin.readline().split()))

def inp():
	return stdin.readline()

def out(x):
	return stdout.write(x)
import math
for _ in range(int(input())):
	s = input()
	A = list(s)
	r = 0
	s = 0
	p = 0
	for i in range(len(A)):
		if A[i] == 'R':
			r += 1
		elif A[i] == 'S':
			s += 1
		else:
			p += 1
	M = max(r, s, p)
	if M == r:
		ans = 'P' * len(A)
	elif M == s:
		ans = 'R' * len(A)
	else:
		ans = 'S' * len(A)
	print(ans)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
for _ in range(int(input())):
	S = input()
	Ans = ''
	n = len(S)
	C = Counter(S)
	i = C.most_common(1)[0][0]
	if i == 'R':
		Ans = 'P' * n
	elif i == 'S':
		Ans = 'R' * n
	else:
		Ans = 'S' * n
	print(Ans)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	s = inp()
	n = len(s)
	d = {}
	d['R'] = 0
	d['S'] = 0
	d['P'] = 0
	for i in range(n):
		d[s[i]] += 1
	mx = 0
	el = ''
	for i in d:
		if d[i] >= mx:
			el = i
			mx = d[i]
	if el == 'R':
		ans = 'P' * n
	if el == 'P':
		ans = 'S' * n
	if el == 'S':
		ans = 'R' * n
	print(ans)
testcase(int(inp()))


for _ in range(int(input())):
	s = input()
	an = ''
	dt = dict()
	dt['R'] = 'P'
	dt['P'] = 'S'
	dt['S'] = 'R'
	mx = 0
	for a in ['R', 'P', 'S']:
		if s.count(a) > mx:
			mx = s.count(a)
			an = dt[a]
	an *= len(s)
	print(an)


t = int(input())
for q in range(t):
	s = input()
	n = len(s)
	hs = [0, 0, 0]
	for i in range(n):
		if s[i] == 'R':
			hs[0] += 1
		elif s[i] == 'P':
			hs[1] += 1
		else:
			hs[2] += 1
	c = 'P'
	if hs[0] == max(hs):
		c = 'P'
	elif hs[1] == max(hs):
		c = 'S'
	else:
		c = 'R'
	for i in range(n):
		print(c, end='')
	print()


t = int(input())
for _ in range(t):
	s = input()
	c = max('RSP', key=s.count)
	response = {'R': 'P', 'P': 'S', 'S': 'R'}[c]
	print(len(s) * response)


def solve():
	s = input()
	ans = ''
	d = {}
	for i in s:
		d[i] = d.get(i, 0) + 1
	maxfreq = max(d.values())
	for i in d:
		if d[i] == maxfreq:
			ans = i
			break
	if ans == 'S':
		return 'R' * len(s)
	if ans == 'R':
		return 'P' * len(s)
	return 'S' * len(s)
	print(ans)
for _ in range(int(input())):
	ans = solve()
	print(ans)


t = int(input())
while t:
	n = input()
	(a, b, c) = (n.count('R'), n.count('P'), n.count('S'))
	d = max(a, b, c)
	if d == a:
		for x in range(len(n)):
			print('P', end='')
	elif d == b:
		for x in range(len(n)):
			print('S', end='')
	elif d == c:
		for x in range(len(n)):
			print('R', end='')
	print()
	t -= 1


def solve(s):
	n = len(s)
	count = {}
	count['R'] = 0
	count['P'] = 0
	count['S'] = 0
	for c in s:
		count[c] += 1
	dpr = count['P'] - count['R']
	dsr = count['S'] - count['R']
	if dpr >= dsr and dsr >= 0:
		(s1, r1, p1) = (n, 0, 0)
	elif dpr >= 0 and 0 >= dsr:
		(s1, r1, p1) = (n, 0, 0)
	elif dsr >= dpr and dpr >= 0:
		(s1, r1, p1) = (0, n, 0)
	elif dsr >= 0 and 0 >= dpr:
		(s1, r1, p1) = (0, n, 0)
	else:
		(s1, r1, p1) = (0, 0, n)
	return 'S' * s1 + 'R' * r1 + 'P' * p1
TN = int(input())
for TI in range(TN):
	print(solve(input()))


for i in range(int(input())):
	s = input()
	a = {'P': 0, 'R': 0, 'S': 0}
	for i in range(len(s)):
		a[s[i]] += 1
	ma = max(a['P'], a['R'], a['S'])
	if a['R'] == ma:
		ans = 'P' * len(s)
	elif a['P'] == ma:
		ans = 'S' * len(s)
	elif a['S'] == ma:
		ans = 'R' * len(s)
	print(ans)


for _ in range(int(input())):
	s = input()
	dictio = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		if i == 'R':
			dictio['P'] += 1
		elif i == 'P':
			dictio['S'] += 1
		elif i == 'S':
			dictio['R'] += 1
	x = list(dictio.keys())
	y = list(dictio.values())
	element = x[y.index(max(y))]
	for i in range(len(s)):
		print(element, end='')
	print('')


r = {'S': 'R', 'P': 'S', 'R': 'P'}
for _ in range(int(input())):
	s = input()
	(sc, pc, rc) = (s.count('S'), s.count('P'), s.count('R'))
	if max(sc, pc, rc) == sc:
		print(r['S'] * len(s))
	elif max(sc, pc, rc) == pc:
		print(r['P'] * len(s))
	elif max(sc, pc, rc) == rc:
		print(r['R'] * len(s))


tests = int(input())
for test in range(tests):
	s = input()
	cnt = {'P': 0, 'R': 0, 'S': 0}
	for ch in s:
		cnt[ch] += 1
	best = 'P'
	for (k, v) in cnt.items():
		if cnt[best] < v:
			best = k
	winner = {'P': 'S', 'R': 'P', 'S': 'R'}
	print(winner[best] * len(s))


t = int(input())
for i in range(t):
	rsp = list(input())
	rpsstring = ''
	rps = {'R': 'P', 'P': 'S', 'S': 'R'}
	rc = 0
	pc = 0
	sc = 0
	for k in rsp:
		if k == 'R':
			rc += 1
			continue
		elif k == 'P':
			pc += 1
			continue
		else:
			sc += 1
	if rc >= pc and rc >= sc:
		print('P' * (rc + pc + sc))
	elif pc > rc and pc >= sc:
		print('S' * (rc + pc + sc))
	elif sc > rc and sc > pc:
		print('R' * (rc + pc + sc))


for _ in range(int(input())):

	def main():
		s = input()
		(x, y, z) = (s.count('P'), s.count('S'), s.count('R'))
		if x == max(x, y, z):
			print('S' * len(s))
		elif y == max(x, y, z):
			print('R' * len(s))
		elif z == max(x, y, z):
			print('P' * len(s))
	main()


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
for _ in range(int(z())):
	l = z()
	lp = {'R': 'P', 'S': 'R', 'P': 'S'}
	x = 0
	for i in list(set(l)):
		s = l.count(i)
		if x <= s:
			st = i
			x = s
	print(lp[st] * len(l))


for i in range(int(input())):
	a = input()
	if a.count('R') >= max(a.count('S'), a.count('P')):
		print('P' * len(a))
	elif a.count('S') >= max(a.count('R'), a.count('P')):
		print('R' * len(a))
	else:
		print('S' * len(a))


import sys
import collections

def split_input():
	return [int(i) for i in input().split()]
tests = int(input())
for _ in range(tests):
	s = input()
	d = {'S': 0, 'P': 0, 'R': 0}
	for i in s:
		d[i] += 1
	x = max(d, key=d.get)
	if x == 'S':
		print('R' * len(s))
	elif x == 'R':
		print('P' * len(s))
	else:
		print('S' * len(s))


import sys

def solve(a):
	result = [' '] * len(a)
	(nr, np, ns) = (0, 0, 0)
	for played in a:
		if played == 'R':
			nr += 1
		elif played == 'P':
			np += 1
		elif played == 'S':
			ns += 1
	MX = 'R'
	if max(nr, np, ns) == np:
		MX = 'S'
	if max(nr, np, ns) == nr:
		MX = 'P'
	for i in range(len(a)):
		result[i] = MX
	return ''.join([str(x) for x in result])
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
cur = 1
for ti in range(T):
	a = [x for x in IN[cur]]
	result = solve(a)
	print(result)
	cur += 1


y = int(input())
for i in range(y):
	r = input()
	s = ''
	R = S = P = 0
	for j in r:
		if j == 'R':
			s += 'P'
			R += 1
		elif j == 'S':
			s += 'R'
			S += 1
		else:
			s += 'S'
			P += 1
	if P == R and S == R:
		print('R' * len(r))
	elif R >= S and R >= P:
		print('P' * len(r))
	elif S >= R and S >= P:
		print('R' * len(r))
	elif P >= S and P >= R:
		print('S' * len(r))


t = int(input())
w = {'R': 'P', 'S': 'R', 'P': 'S'}
for c in range(t):
	s = input()
	count = {'R': 0, 'S': 0, 'P': 0}
	for x in s:
		count[x] += 1
	print(w[max(count, key=lambda key: count[key])] * len(s))


for u in range(int(input())):
	s = input()
	n = len(s)
	h = dict()
	l = ['R', 'S', 'P']
	r = ['P', 'R', 'S']
	for i in l:
		h[s.count(i)] = i
	t = max(h)
	out = [r[l.index(h[t])]] * n
	print(''.join(out))


from collections import Counter

def solve(a):
	mp = {'R': 'P', 'P': 'S', 'S': 'R'}
	mx = -1
	counter = Counter(a)
	for i in counter:
		if counter[i] > mx:
			ans = i
			mx = counter[i]
	print(mp[ans] * len(a))

def main():
	inp = lambda : [int(x) for x in input().split()]
	tc = int(input())
	for _ in range(tc):
		a = input()
		solve(a)
main()


t = int(input())
from collections import Counter
for i in range(t):
	s = list(input())
	x = Counter(s)
	key = 0
	maxi = 0
	for m in x:
		if x[m] > maxi:
			maxi = x[m]
			key = m
	if key == 'R':
		print('P' * len(s), end='')
	elif key == 'S':
		print('R' * len(s), end='')
	else:
		print('S' * len(s), end='')
	print()


t = int(input())
while t:
	t -= 1
	s = input()
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	if R == max([R, S, P]):
		print('P' * len(s))
	elif S == max([R, S, P]):
		print('R' * len(s))
	else:
		print('S' * len(s))


for _ in range(int(input())):
	s = input()
	most_signs = max(set(s), key=s.count)
	sign = 'R'
	if most_signs == 'P':
		sign = 'S'
	elif most_signs == 'R':
		sign = 'P'
	result = sign * len(s)
	print(result)


import operator

def solve():
	s = input()
	opts = 'RSP'
	count = {'R': 0, 'S': 0, 'P': 0}
	for c in s:
		c_ = opts[(opts.index(c) - 1) % 3]
		count[c_] += 1
	return max(count.items(), key=operator.itemgetter(1))[0] * len(s)
T = int(input())
for case in range(T):
	print(solve())


for _ in range(int(input())):
	s = input()
	dic = {'S': 'R', 'R': 'P', 'P': 'S'}
	d = {'S': 0, 'R': 0, 'P': 0}
	for i in s:
		d[i] += 1
	if d['S'] == max(d.values()):
		print('R' * len(s))
	elif d['R'] == max(d.values()):
		print('P' * len(s))
	elif d['P'] == max(d.values()):
		print('S' * len(s))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		s = S()
		c = collections.Counter(s)
		m = max([(v, k) for (k, v) in c.items()])
		if m[1] == 'R':
			r = 'P'
		elif m[1] == 'S':
			r = 'R'
		else:
			r = 'S'
		rr.append(r * len(s))
	return JA(rr, '\n')
print(main())


for _ in range(int(input())):
	s = input()
	d = {'R': 0, 'P': 0, 'S': 0}
	for i in s:
		d[i] += 1
	maximal = max(list(d.items()), key=lambda x: x[1])
	c = maximal[0]
	if c == 'R':
		ans = 'P'
	elif c == 'P':
		ans = 'S'
	else:
		ans = 'R'
	print(ans * len(s))


n = int(input())
for _ in range(n):
	a = str(input())
	d = len(a)
	(p, s, r) = (a.count('P'), a.count('S'), a.count('R'))
	if max(p, s, r) == p:
		b = d * 'S'
	elif max(p, s, r) == s:
		b = d * 'R'
	else:
		b = d * 'P'
	print(b)


def solve(s):
	ans = ''
	r = 'R' * len(s)
	S = 'S' * len(s)
	p = 'P' * len(s)
	(cnt1, cnt2, cnt3) = (s.count('R'), s.count('S'), s.count('P'))
	if cnt1 >= cnt2 and cnt1 >= cnt3:
		print(p)
	elif cnt2 >= cnt1 and cnt2 >= cnt3:
		print(r)
	else:
		print(S)

def main():
	t = int(input())
	for i in range(t):
		solve(input())
main()


for tc in range(int(input())):
	A = input()
	R = 0
	S = 0
	P = 0
	for i in A:
		exec(i + '+=1')
	if R >= S and R >= P:
		print('P' * len(A))
	elif S >= R and S >= P:
		print('R' * len(A))
	else:
		print('S' * len(A))


import sys, math, cmath, time
start_time = time.time()

def solve():
	s = insr()
	q = s.count('R')
	w = s.count('P')
	qw = s.count('S')
	if q >= w and q >= qw:
		qq = 'P' * len(s)
	elif w >= q and w >= qw:
		qq = 'S' * len(s)
	else:
		qq = 'R' * len(s)
	print(qq)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a, qw):
	q = [0] * qw
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = (q[ord(a[i]) - 97], 1)
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


from collections import Counter
n = int(input())
for case in range(n):
	game = [s for s in input()]
	counter_g = Counter(game)
	r_qtt = counter_g['R']
	p_qtt = counter_g['P']
	s_qtt = counter_g['S']
	if r_qtt >= p_qtt and r_qtt >= s_qtt:
		print('P' * len(game))
	elif p_qtt >= s_qtt and p_qtt >= r_qtt:
		print('S' * len(game))
	elif s_qtt >= p_qtt and s_qtt >= r_qtt:
		print('R' * len(game))


import math
from collections import deque
import sys
sys.setrecursionlimit(10 ** 4)

def Divisors(n):
	l = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def Factors(n):
	result = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if i == n / i:
				result.append(i)
			else:
				result.append(i)
				result.append(n // i)
	result.append(1)
	return result

def maxSubArraySum(a):
	max_so_far = 0
	max_ending_here = 0
	size = len(a)
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < abs(max_ending_here):
			max_so_far = max_ending_here
	return max_so_far

def longestsubarray(arr, n, k):
	current_count = 0
	max_count = 0
	for i in range(0, n, 1):
		if arr[i] % k != 0:
			current_count += 1
		else:
			current_count = 0
		max_count = max(current_count, max_count)
	return max_count

def main():
	s = input()
	n = len(s)
	s1 = ''
	c1 = 0
	c2 = 0
	c3 = 0
	for i in range(0, len(s)):
		if s[i] == 'R':
			c1 += 1
		if s[i] == 'S':
			c2 += 1
		if s[i] == 'P':
			c3 += 1
	if c1 >= c2 and c1 >= c3:
		for i in range(0, n):
			print('P', end='')
		print()
	elif c2 >= c1 and c2 >= c3:
		for i in range(0, n):
			print('R', end='')
		print()
	else:
		for i in range(0, n):
			print('S', end='')
		print()
t = int(input())
for i in range(0, t):
	main()


for _ in range(int(input())):
	n = input()
	(ans, tmp) = (0, '')
	l = len(n)
	d = {'R': 0, 'P': 0, 'S': 0}
	for letter in n:
		d[letter] += 1
		if d[letter] > ans:
			ans = d[letter]
			if letter == 'P':
				tmp = 'S'
			if letter == 'R':
				tmp = 'P'
			if letter == 'S':
				tmp = 'R'
	print(l * tmp)


from collections import defaultdict
import math
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	dic = {}
	dic[s.count('R')] = 'P'
	dic[s.count('S')] = 'R'
	dic[s.count('P')] = 'S'
	ch = max(list(dic.keys()))
	ans = dic[ch] * n
	print(ans)


t = input()
for i in range(int(t)):
	string = input()
	frequency = [0, 0, 0]
	for j in string:
		if j == 'R':
			frequency[0] += 1
		elif j == 'S':
			frequency[1] += 1
		elif j == 'P':
			frequency[2] += 1
	a = max(frequency)
	if frequency.index(a) == 0:
		print('P' * len(string))
	elif frequency.index(a) == 1:
		print('R' * len(string))
	elif frequency.index(a) == 2:
		print('S' * len(string))


t = int(input())
from collections import Counter
for _ in range(t):
	s = list(str(input()))
	C = Counter(s)
	X = list(C.items())
	X.sort(key=lambda x: -x[1])
	if X[0][0] == 'R':
		ans = 'P' * len(s)
	elif X[0][0] == 'S':
		ans = 'R' * len(s)
	else:
		ans = 'S' * len(s)
	print(ans)


for _ in range(int(input())):
	s = input()
	rs = s.count('R')
	ps = s.count('P')
	ss = s.count('S')
	if rs >= ps and rs >= ss:
		print('P' * len(s))
	elif ps >= rs and ps >= ss:
		print('S' * len(s))
	else:
		print('R' * len(s))


for i in range(int(input())):
	st = input()
	n = len(st)
	(r, p, s) = (st.count('R'), st.count('P'), st.count('S'))
	if max(r, p, s) == r:
		print('P' * n)
	elif max(r, p, s) == p:
		print('S' * n)
	else:
		print('R' * n)


import math
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	r = s.count('R')
	p = s.count('P')
	s = s.count('S')
	m = max(r, s, p)
	if r == m:
		ans = 'P' * n
	elif s == m:
		ans = 'R' * n
	elif p == m:
		ans = 'S' * n
	print(ans)


T = int(input())
for t in range(T):
	s = input()
	RPS = [0, 0, 0]
	for c in s:
		if c == 'R':
			RPS[0] += 1
		elif c == 'P':
			RPS[1] += 1
		else:
			RPS[2] += 1
	max_i = RPS.index(max(RPS))
	if max_i == 0:
		print(''.join(['P' for x in range(len(s))]))
	elif max_i == 1:
		print(''.join(['S' for x in range(len(s))]))
	else:
		print(''.join(['R' for x in range(len(s))]))


t = int(input())
while t:
	s = input()
	count1 = 0
	count2 = 0
	count3 = 0
	for i in s:
		if i == 'R':
			count1 = count1 + 1
		elif i == 'S':
			count2 = count2 + 1
		else:
			count3 = count3 + 1
	if max(count1, count2, count3) == count1:
		print('P' * len(s))
	elif max(count1, count2, count3) == count2:
		print('R' * len(s))
	else:
		print('S' * len(s))
	t = t - 1


class Main:

	def main(self):
		t = int(input())
		for t1 in range(0, t):
			s = input()
			c1 = s.count('R')
			c2 = s.count('S')
			c3 = s.count('P')
			if max(c1, c2, c3) == c1:
				print('P' * len(s))
			elif max(c1, c2, c3) == c2:
				print('R' * len(s))
			else:
				print('S' * len(s))
Main().main()


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	n = len(s)
	x = s.count('R')
	y = s.count('P')
	z = s.count('S')
	if x >= y and x >= z:
		c = 'P' * n
	elif y >= x and y >= z:
		c = 'S' * n
	elif z >= y and z >= x:
		c = 'R' * n
	print(c)


t = int(input())
for _ in range(t):
	r = 0
	s = 0
	p = 0
	pro = input()
	for i in range(len(pro)):
		if pro[i] == 'R':
			r = r + 1
		elif pro[i] == 'S':
			s = s + 1
		else:
			p = p + 1
	max_ = max(r, s, p)
	if max_ == r:
		print('P' * len(pro))
	elif max_ == s:
		print('R' * len(pro))
	else:
		print('S' * len(pro))


for _ in range(int(input())):
	s = input()
	mp = {'R': 0, 'S': 0, 'P': 0}
	mp2 = {'R': 'P', 'S': 'R', 'P': 'S'}
	for ch in s:
		mp[ch] += 1
	mx = max(mp, key=mp.get)
	print(mp2[mx] * len(s))


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	hashm = {}
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		s = insr()
		R = 'R'
		S = 'S'
		P = 'P'
		ans = ''
		rock = 0
		paper = 0
		sis = 0
		for i in s:
			if i == R:
				rock = rock + 1
			elif i == P:
				paper = paper + 1
			elif i == S:
				sis = sis + 1
		if max(sis, paper, rock) == rock:
			ans = P * len(s)
		elif max(sis, paper, rock) == paper:
			ans = S * len(s)
		else:
			ans = R * len(s)
		print(ans)
main()


import sys
lines = []
for line in sys.stdin:
	if 'exit' == line.rstrip().lower():
		break
	lines.append(line)
t = int(lines[0])
for case in range(1, t + 1):
	st = lines[case].strip()
	s = 0
	p = 0
	r = 0
	for char in st:
		if char == 'R':
			r += 1
		elif char == 'P':
			p += 1
		elif char == 'S':
			s += 1
	n = len(st)
	if s >= p and s >= r:
		print('R' * n)
	elif p >= r and p >= s:
		print('S' * n)
	else:
		print('P' * n)


for i in range(int(input())):
	s = input()
	n = len(s)
	R = s.count('R')
	P = s.count('P')
	S = s.count('S')
	if R > P:
		if R > S:
			print('P' * n)
		else:
			print('R' * n)
	elif P > S:
		print('S' * n)
	else:
		print('R' * n)


t = int(input())
for i in range(t):
	s = input()
	b = []
	for j in s:
		b.append(j)
	n = len(b)
	x = b.count('R')
	y = b.count('P')
	z = b.count('S')
	m = max(x, y, z)
	if x == m:
		res = ['P'] * n
	elif y == m:
		res = ['S'] * n
	elif z == m:
		res = ['R'] * n
	print(''.join(res))


import collections
t = input()
t = int(t)
for i in range(t):
	s = input()
	s_i = collections.Counter(s).most_common(1)[0][0]
	if s_i == 'R':
		print('P' * len(s))
	if s_i == 'S':
		print('R' * len(s))
	if s_i == 'P':
		print('S' * len(s))


from sys import stdin
t = int(stdin.readline().strip())
for i in range(t):
	S = list(stdin.readline().strip())
	r = len([c for c in S if c == 'R'])
	s = len([c for c in S if c == 'S'])
	p = len([c for c in S if c == 'P'])
	if r == max(r, s, p):
		print('P' * len(S))
	elif s == max(r, s, p):
		print('R' * len(S))
	elif p == max(r, s, p):
		print('S' * len(S))


from collections import Counter
t = int(input())
letters = ['R', 'P', 'S']
numbers = [0, 1, 2]
d = dict(zip(letters, numbers))
dinv = dict(zip(numbers, letters))
for _ in range(t):
	s = input()
	values = [d[x] for x in s]
	values = Counter(values)
	level = values.most_common(1)[0][0]
	response = (level + 1) % 3
	c = ''.join([dinv[response] for _ in s])
	print(c)


import os, io
from sys import stdout
import collections
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def binomial_coefficient(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def powerOfK(k, max):
	if k == 1:
		return [1]
	if k == -1:
		return [-1, 1]
	result = []
	n = 1
	while n <= max:
		result.append(n)
		n *= k
	return result

def divisors(n):
	i = 1
	result = []
	while i * i <= n:
		if n % i == 0:
			if n / i == i:
				result.append(i)
			else:
				result.append(i)
				result.append(n / i)
		i += 1
	return result

def distance(xa, ya, xb, yb):
	return ((ya - yb) ** 2 + (xa - xb) ** 2) ** 0.5

def digitsSum(n):
	if n == 0:
		return 0
	r = 0
	while n > 0:
		r += n % 10
		n //= 10
	return r

def isValid(i, j, n, m):
	return i >= 0 and i < n and (j >= 0) and (j < m)

def print_grid(grid):
	for line in grid:
		print(' '.join(map(str, line)))

def kadane(a, size):
	max_so_far = 0
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def prefixSum(arr):
	for i in range(1, len(arr)):
		arr[i] = arr[i] + arr[i - 1]
	return arr

def ceil(n, d):
	if n % d == 0:
		return n // d
	else:
		return n // d + 1

def _abs(a, b):
	return int(abs(a - b))

def evenodd(l):
	even = [e for e in l if e & 1 == 0]
	odd = [e for e in l if e & 1]
	return (even, odd)
from collections import Counter
t = int(input())
map = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(t):
	s = input().decode('utf-8').strip()
	c = Counter(s)
	m = c.most_common()[0][0]
	print(map[m] * len(s))


t = int(input())
for _ in range(t):
	(a, b, c) = (0, 0, 0)
	for x in input():
		if x == 'P':
			a += 1
		elif x == 'R':
			b += 1
		else:
			c += 1
	if a == max(a, b, c):
		print('S' * (a + b + c))
	elif b == max(a, b, c):
		print('P' * (a + b + c))
	else:
		print('R' * (a + b + c))


for _ in range(int(input())):
	s1 = input()
	l = len(s1)
	(r, s, p) = (s1.count('R'), s1.count('S'), s1.count('P'))
	maxicount = max(r, max(s, p))
	if maxicount == p:
		print('S' * l)
	elif maxicount == r:
		print('P' * l)
	else:
		print('R' * l)


import bisect
import copy
import fractions
import heapq
import math
import random
import sys
T = int(input())
for t in range(T):
	moves = input()
	cipher = {'R': 'P', 'P': 'S', 'S': 'R'}
	counts = {}
	for ch in moves:
		if ch not in counts:
			counts[ch] = 0
		counts[ch] += 1
	print(cipher[max(counts.items(), key=lambda x: x[1])[0]] * len(moves))


from collections import defaultdict
for _ in range(int(input())):
	s = input()
	mp = defaultdict(int)
	for x in s:
		mp[x] += 1
	n = len(s)
	ans = ''
	mex = -1
	for i in mp:
		mex = max(mp[i], mex)
	if mp['R'] == mex:
		print('P' * n)
	elif mp['S'] == mex:
		print('R' * n)
	else:
		print('S' * n)


t = int(input())
ans = []
for _ in range(t):
	s = input()
	R = 0
	S = 0
	P = 0
	l = len(s)
	for i in range(len(s)):
		if s[i] == 'R':
			R += 1
		elif s[i] == 'S':
			S += 1
		else:
			P += 1
	m = max(R, S, P)
	if S == m:
		res = 'R' * l
		ans.append(res)
		continue
	elif R == m:
		res = 'P' * l
		ans.append(res)
		continue
	else:
		res = 'S' * l
		ans.append(res)
for i in range(len(ans)):
	print(ans[i])


import math
t = int(input())
for _ in range(t):
	a = list(input())
	s = p = r = 0
	for i in range(len(a)):
		if a[i] == 'S':
			s += 1
		elif a[i] == 'R':
			r += 1
		else:
			p += 1
	if max(s, p, r) == s:
		print('R' * len(a))
	elif max(s, p, r) == p:
		print('S' * len(a))
	else:
		print('P' * len(a))


import math
I = lambda : list(map(int, input().split(' ')))
for _ in range(int(input())):
	out = {'R': 'P', 'S': 'R', 'P': 'S'}
	dct = {}
	dct['R'] = 0
	dct['S'] = 0
	dct['P'] = 0
	s = input()
	for ele in s:
		dct[ele] += 1
	c = sorted([(dct[key], key) for key in dct.keys()])[-1]
	n = len(s)
	print(''.join([out[c[1]]] * n))


for testcase in range(int(input())):
	s = input().strip()
	cnt = {'R': 0, 'S': 0, 'P': 0}
	for i in s:
		cnt[i] += 1
	(_, w) = max(zip(cnt.values(), cnt.keys()))
	ans = {'R': 'P', 'P': 'S', 'S': 'R'}[w] * len(s)
	print(ans)


for i in range(int(input())):
	n = input()
	a = n.count('R')
	b = n.count('S')
	c = n.count('P')
	l = len(n)
	print((a >= b and a >= c) * l * 'P' + (b >= c and b > a) * l * 'R' + (c > a and c > b) * l * 'S')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	s = input()
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	C = Counter(s)
	count = max(C.values())
	for i in C:
		if C[i] == count:
			ans = win[i]
			break
	print(ans * len(s))


for test_case in range(int(input())):
	string = input()
	ans = ''
	r = 0
	p = 0
	s = 0
	for x in string:
		if x == 'R':
			r += 1
		elif x == 'P':
			p += 1
		else:
			s += 1
	arr = [r, p, s]
	arr2 = ['P', 'S', 'R']
	ans = arr2[arr.index(max(arr))]
	ans = ans * len(string)
	print(ans)


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
d = dd(chr)
d['R'] = 'P'
d['P'] = 'S'
d['S'] = 'R'
t = int(input())
while t:
	s = input().split()[0]
	n = len(s)
	cr = s.count('R')
	cs = s.count('S')
	cp = n - cr - cs
	if cr >= cs and cr >= cp:
		ss = 'P' * n
	if cs >= cr and cs >= cp:
		ss = 'R' * n
	if cp >= cs and cp >= cr:
		ss = 'S' * n
	print(ss)
	t -= 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(S):
	freq = Counter(S)
	opposite = {'R': 'P', 'P': 'S', 'S': 'R'}
	best = max(freq.keys(), key=lambda k: freq[k])
	N = len(S)
	return opposite[best] * N
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	S = input().decode().rstrip()
	ans = solve(S)
	print(ans)


from __future__ import division, print_function
import itertools, os, sys, threading
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect
from random import randrange
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().strip().split(' ')))

def main():
	for _ in range(int(input())):
		t = input()
		ans = ''
		dic = {'R': 'P', 'P': 'S', 'S': 'R'}
		c = Counter(t)
		s = c.most_common()[0][0]
		print(dic[s] * len(t))
main()


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve(s):
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	(rr, ss, pp) = (0, 0, 0)
	for i in s:
		if i == 'R':
			rr += 1
		if i == 'S':
			ss += 1
		if i == 'P':
			pp += 1
	maxx = max(rr, ss, pp)
	if rr == maxx:
		print(d['R'] * len(s))
	elif ss == maxx:
		print(d['S'] * len(s))
	elif pp == maxx:
		print(d['P'] * len(s))
for _ in range(int(input())):
	s = str(input())[:-1]
	solve(s)


t = int(input())
for i in range(t):
	s1 = input()
	n = len(s1)
	p = s1.count('R')
	s = s1.count('P')
	r = s1.count('S')
	x = max(r, max(p, s))
	if x == r:
		print('R' * n)
	elif x == p:
		print('P' * n)
	else:
		print('S' * n)


t = int(input())
for i in range(t):
	l = input()
	n = len(l)
	k = 0
	no = 0
	b = 0
	for j in range(n):
		if l[j] == 'R':
			k += 1
		elif l[j] == 'S':
			no += 1
		else:
			b += 1
	if max(k, no, b) == b:
		for i2 in range(n):
			print('S', end='')
		print()
	elif max(k, no, b) == no:
		for i2 in range(n):
			print('R', end='')
		print()
	else:
		for i2 in range(n):
			print('P', end='')
		print()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from itertools import permutations
from collections import *
from collections import deque
from operator import itemgetter, attrgetter
from decimal import *
import bisect
import math
import heapq as hq
MOD = 10 ** 9 + 7

def is_prime(n):
	if n == 2 or n == 3:
		return True
	if n < 2 or n % 2 == 0:
		return False
	if n < 9:
		return True
	if n % 3 == 0:
		return False
	r = int(n ** 0.5)
	f = 5
	while f <= r:
		if n % f == 0:
			return False
		if n % (f + 2) == 0:
			return False
		f += 6
	return True

def pow(a, b, m):
	ans = 1
	while b:
		if b & 1:
			ans = ans * a % m
		b //= 2
		a = a * a % m
	return ans

def ispalindrome(s):
	if s[:] == s[::-1]:
		return 1
	return 0
dp = []
limit = []
v = []

def dpdfs(u, t=-1):
	dp[0][u] = 0
	dp[1][u] = 0
	for i in v[u]:
		if i == t:
			continue
		if dp[1][i] == -1:
			dpdfs(i, u)
		dp[0][u] += max(abs(limit[0][u] - limit[1][i]) + dp[1][i], abs(limit[0][u] - limit[0][i]) + dp[0][i])
		dp[1][u] += max(abs(limit[1][u] - limit[1][i]) + dp[1][i], abs(limit[1][u] - limit[0][i]) + dp[0][i])
vis = []
f = 0

def dfs(i):
	vis[i] = 1
	act[i] = 1
	for j in v[i]:
		if act[j]:
			f = 1
			return -1
		if vis[j] == 0:
			if dfs(j) == -1:
				return -1
	act[i] = 0
	ans.append(i)
	return 0
from queue import PriorityQueue

def z_algorithm(s):
	res = [0] * len(s)
	res[0] = len(s)
	(i, j) = (1, 0)
	while i < len(s):
		while i + j < len(s) and s[j] == s[i + j]:
			j += 1
		res[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < len(s) and k + res[k] < j:
			res[i + k] = res[k]
			k += 1
		(i, j) = (i + k, j - k)
	return res

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a / gcd(a, b) * b

def gcdExtended(a, b):
	if a == 0:
		return (b, 0, 1)
	(gcd, x1, y1) = gcdExtended(b % a, a)
	x = y1 - b // a * x1
	y = x1
	return (gcd, x, y)
import re
for _ in range(int(input())):
	cntP = 0
	cntR = 0
	cntS = 0
	s = input()
	l = []
	for i in s:
		if i == 'P':
			cntS += 1
		elif i == 'R':
			cntP += 1
		else:
			cntR += 1
	if cntP >= max(cntR, cntS):
		print(len(s) * 'P')
	elif cntS >= max(cntP, cntR):
		print(len(s) * 'S')
	else:
		print(len(s) * 'R')


for x in range(int(input())):
	s = input()
	s = list(s)
	a = [0, 0, 0]
	b = ['R', 'P', 'S']
	for i in range(len(s)):
		if s[i] == 'R':
			a[0] += 1
		elif s[i] == 'P':
			a[1] += 1
		else:
			a[2] += 1
	l = ''
	k = max(a)
	if len(set(a)) == 1:
		for i in range(len(s)):
			if s[i] == 'R':
				l += 'P'
			elif s[i] == 'P':
				l += 'S'
			else:
				l += 'R'
	elif a.index(k) == 0:
		l = len(s) * 'P'
	elif a.index(k) == 1:
		l = len(s) * 'S'
	else:
		l = len(s) * 'R'
	print(l)


t = int(input())
l = []
l1 = []
for i in range(0, t):
	s = input()
	R = 0
	S = 0
	P = 0
	l = []
	l1 = []
	l = list(s)
	le = len(l)
	for j in range(0, le):
		if l[j] == 'P':
			P = P + 1
		elif l[j] == 'R':
			R = R + 1
		elif l[j] == 'S':
			S = S + 1
	m = max(R, S, P)
	c = 0
	if m == R and c == 0:
		for d in range(0, le):
			l1.append('P')
		c = 1
	elif m == S and c == 0:
		for d in range(0, le):
			l1.append('R')
		c = 1
	elif m == P and c == 0:
		for d in range(0, le):
			l1.append('S')
		c = 1
	c = 0
	for e in range(0, le):
		print(l1[e], end='')
	print('\n')


from sys import stdin
for _ in range(int(input())):
	l = input()
	r = l.count('R')
	s = l.count('S')
	p = l.count('P')
	if r == max(r, s, p):
		print('P' * len(l))
	elif s == max(r, s, p):
		print('R' * len(l))
	else:
		print('S' * len(l))


for t in range(int(input())):
	a = input()
	r = 0
	s = 0
	p = 0
	for c in a:
		if c == 'R':
			r += 1
		if c == 'S':
			s += 1
		if c == 'P':
			p += 1
	if s <= r >= p:
		print('P' * len(a))
	elif s <= p >= r:
		print('S' * len(a))
	else:
		print('R' * len(a))


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
for _ in range(inp()):
	s = input().strip()
	n = len(s)
	dt = {}
	for i in s:
		dt[i] = dt.get(i, 0) + 1
	mx = -1
	for i in dt:
		if dt[i] == max(dt.values()):
			mx = i
	game = ['P', 'S', 'R']
	print(game[(game.index(mx) + 1) % 3] * n)


t = int(input())
for i in range(0, t):
	s = input()
	R = 0
	S = 0
	P = 0
	for item in s:
		if item == 'S':
			S += 1
		if item == 'R':
			R += 1
		if item == 'P':
			P += 1
	if S > R and S > P:
		print('R' * (S + R + P))
	elif R > P:
		print('P' * (S + R + P))
	else:
		print('S' * (S + R + P))


from collections import Counter
for _ in range(int(input())):
	st = [i for i in input()]
	n = len(st)
	d = Counter(st)
	ans = []
	r = 0
	s = 0
	p = 0
	for (key, value) in d.items():
		if key == 'R':
			r = value
		elif key == 'S':
			s = value
		else:
			p = value
	if r > s and r > p:
		ans = ['P'] * n
	elif s > r and s > p:
		ans = ['R'] * n
	elif p > s and p > r:
		ans = ['S'] * n
	elif p == s and p > r:
		ans = ['S'] * n
	elif s == r and s > p:
		ans = ['R'] * n
	elif p == r and p > s:
		ans = ['P'] * n
	elif p == s == r:
		ans = ['R'] * n
	print(''.join(ans))