#include using namespace std; #define For(i, a, b) for(int i = (a); i < (b); i++) #define rep(i, n) For(i, 0, n) #define rFor(i, a, b) for(int i = (a); i >= (b); i--) #define ALL(v) (v).begin(), (v).end() #define rALL(v) (v).rbegin(), (v).rend() #define SZ(v) ((int)(v).size()) using lint = long long; using ld = long double; int INF = 2000000000; lint LINF = 1000000000000000000; struct SetupIo { SetupIo() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); } } setupio; // a <- max(a, b) template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } // a <- min(a, b) template bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } int main() { int N; cin >> N; vector P(N); rep(i, N) { cin >> P[i]; } int head = 0; while (true) { bool ok = true; rep(i, N) { int x = i, y = (i + 1) % N; if (P[y] != 0 && P[x] > P[y]) { ok = false; } } if (ok) { break; } int x = head, y = (head + 1) % N; if (P[y] != 0 && P[x] > P[y]) { cout << "S"; swap(P[x], P[y]); } cout << "R"; head = (head + 1) % N; } while (P[head] != 0) { cout << "R"; head = (head + 1) % N; } cout << "\n"; return 0; }