#include #include #include #include #include #include #include #include #include namespace ranges = std::ranges; namespace views = std::views; // #include "Src/Number/IntegerDivision.hpp" // #include "Src/Utility/BinarySearch.hpp" // #include "Src/Sequence/CompressedSequence.hpp" // #include "Src/Sequence/RunLengthEncoding.hpp" // #include "Src/Algebra/Group/AdditiveGroup.hpp" // #include "Src/DataStructure/FenwickTree/FenwickTree.hpp" // #include "Src/DataStructure/SegmentTree/SegmentTree.hpp" // #include "Src/DataStructure/DisjointSetUnion/DisjointSetUnion.hpp" // using namespace zawa; // #include "atcoder/modint" // using mint = atcoder::modint998244353; int N, P[100]; int main() { std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios::sync_with_stdio(false); std::cin >> N; for (int i = 0 ; i < N ; i++) std::cin >> P[i]; std::string ans; while (true) { int f = -1; for (int i = 0 ; f == -1 and i < N ; i++) { if (P[i] > P[i + 1] and P[(i + 1) % N] != 0) f = i; } if (f == -1) break; ans += std::string(f, 'R'); std::vector p(N); for (int i = 0 ; i < N ; i++) p[i] = P[(i + f) % N]; for (int i = 0 ; i < N ; i++) P[i] = p[i]; assert(P[0] > P[1] and P[1] != 0); ans += 'S'; std::swap(P[0], P[1]); } int f = ranges::find(P, P + N, 0) - P; ans += std::string(f, 'R'); std::cout << ans << '\n'; }