#include #include using namespace std; using namespace atcoder; // using mint = modint1000000007; // const int mod = 1000000007; // using mint = modint998244353; // const int mod = 998244353; // const int INF = 1e9; // const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i, l, r) for (int i = (l); i < (r); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rrep2(i, l, r) for (int i = (r)-1; i >= (l); --i) #define all(x) (x).begin(), (x).end() #define allR(x) (x).rbegin(), (x).rend() #define P pair template inline bool chmax(A& a, const B& b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A& a, const B& b) { if (a > b) { a = b; return true; } return false; } /** * @file lazy_segtree_variants.hpp * @brief Lazy Segment Tree の各種バリエーション * @author kwm_t * @see https://github.com/kwm-t/cp-library/blob/main/acl_wrapper/lazy_segtree_variants.hpp */ #ifndef KWM_T_ACLWRAPPER_LAZY_SEGTREE_VARIANTS_HPP #define KWM_T_ACLWRAPPER_LAZY_SEGTREE_VARIANTS_HPP #include #include #include #include #include /** * @brief LazySegTree の典型パターン集 * * 提供: * - Range Add / Min, Max, Sum * - Range Update / Min, Max, Sum * - Arithmetic Progression Add / Sum * - Min/Max with Count * - Affine Transform (template) * * 注意: * - INF は long long 前提 * - size は init() で必ず 1 を入れること * verified: * - https://atcoder.jp/contests/practice2/submissions/74233369 */ namespace kwm_t::aclwrapper { // ================= Range Add / Min ================= namespace RangeAddRangeMin { using S = long long; using F = long long; static constexpr long long INF = (long long)4e18; S op(S a, S b) { return std::min(a, b); } S e() { return INF; } S mapping(F f, S x) { return f + x; } F composition(F f, F g) { return f + g; } F id() { return 0; } using lazy_segtree = atcoder::lazy_segtree; } namespace RangeAddRangeMinIndex { struct S { long long val; int idx; }; using F = long long; static constexpr long long INF = (long long)4e18; S op(S a, S b) { if (a.val != b.val) return (a.val < b.val ? a : b); return (a.idx < b.idx ? a : b); } S e() { return { INF, INT_MAX }; } S mapping(F f, S x) { return { x.val + f, x.idx }; } F composition(F f, F g) { return f + g; } F id() { return 0; } using lazy_segtree = atcoder::lazy_segtree; } // ================= Range Add / Max ================= namespace RangeAddRangeMax { using S = long long; using F = long long; static constexpr long long INF = (long long)4e18; S op(S a, S b) { return std::max(a, b); } S e() { return -INF; } S mapping(F f, S x) { return f + x; } F composition(F f, F g) { return f + g; } F id() { return 0; } using lazy_segtree = atcoder::lazy_segtree; } // ================= Range Add / Sum ================= namespace RangeAddRangeSum { struct S { long long value; int size; }; using F = long long; S op(S a, S b) { return { a.value + b.value, a.size + b.size }; } S e() { return { 0, 0 }; } S mapping(F f, S x) { return { x.value + f * x.size, x.size }; } F composition(F f, F g) { return f + g; } F id() { return 0; } using lazy_segtree = atcoder::lazy_segtree; std::vector init(int n, long long val = 0) { return std::vector(n, { val, 1 }); } } // ================= Range Update / Min ================= namespace RangeUpdateRangeMin { using S = long long; using F = long long; static constexpr long long INF = (long long)4e18; static constexpr long long ID = (long long)4e18; S op(S a, S b) { return std::min(a, b); } S e() { return INF; } S mapping(F f, S x) { return (f == ID ? x : f); } F composition(F f, F g) { return (f == ID ? g : f); } F id() { return ID; } using lazy_segtree = atcoder::lazy_segtree; } // ================= Range Update / Max ================= namespace RangeUpdateRangeMax { using S = long long; using F = long long; static constexpr long long INF = (long long)4e18; static constexpr long long ID = (long long)4e18; S op(S a, S b) { return std::max(a, b); } S e() { return -INF; } S mapping(F f, S x) { return (f == ID ? x : f); } F composition(F f, F g) { return (f == ID ? g : f); } F id() { return ID; } using lazy_segtree = atcoder::lazy_segtree; } // ================= Range Update / Sum ================= namespace RangeUpdateRangeSum { struct S { long long value; int size; }; using F = long long; static constexpr long long ID = (long long)4e18; S op(S a, S b) { return { a.value + b.value, a.size + b.size }; } S e() { return { 0, 0 }; } S mapping(F f, S x) { if (f == ID) return x; x.value = f * x.size; return x; } F composition(F f, F g) { return (f == ID ? g : f); } F id() { return ID; } using lazy_segtree = atcoder::lazy_segtree; std::vector init(int n, long long val = 0) { return std::vector(n, { val, 1 }); } } // ================= Arithmetic Progression ================= namespace AddArithmeticProgression { struct S { long long val_sum, index_sum, len; }; struct F { long long a, b; }; S op(S x, S y) { return { x.val_sum + y.val_sum, x.index_sum + y.index_sum, x.len + y.len }; } S e() { return { 0, 0, 0 }; } S mapping(F f, S x) { return { x.val_sum + f.a * x.index_sum + f.b * x.len, x.index_sum, x.len }; } F composition(F f, F g) { return { f.a + g.a, f.b + g.b }; } F id() { return { 0, 0 }; } using lazy_segtree = atcoder::lazy_segtree; } // ================= Max + Count ================= namespace RangeAddRangeMaxCount { using S = std::pair; using F = long long; static constexpr long long INF = (long long)4e18; S op(S a, S b) { if (a.first > b.first) return a; if (a.first < b.first) return b; return { a.first, a.second + b.second }; } S e() { return { -INF, 0 }; } S mapping(F f, S x) { return { x.first + f, x.second }; } F composition(F f, F g) { return f + g; } F id() { return 0; }; using lazy_segtree = atcoder::lazy_segtree; std::vector init(int n, long long val = 0) { return std::vector(n, { val, 1 }); } } // ================= Min + Count ================= namespace RangeAddRangeMinCount { using S = std::pair; using F = long long; static constexpr long long INF = (long long)4e18; S op(S a, S b) { if (a.first < b.first) return a; if (a.first > b.first) return b; return { a.first, a.second + b.second }; } S e() { return { INF, 0 }; } S mapping(F f, S x) { return { x.first + f, x.second }; } F composition(F f, F g) { return f + g; } F id() { return 0; } using lazy_segtree = atcoder::lazy_segtree; std::vector init(int n, long long val = 0) { return std::vector(n, { val, 1 }); } } // ================= Affine (Template) ================= template struct RangeAffineRangeSum { struct S { mint sum; int size; }; struct F { mint b, c; }; static S op(S l, S r) { return { l.sum + r.sum, l.size + r.size }; } static S e() { return { mint(0), 0 }; } static S mapping(F f, S x) { return { f.b * x.sum + f.c * x.size, x.size }; } static F composition(F f, F g) { return { f.b * g.b, f.b * g.c + f.c }; } static F id() { return { mint(1), mint(0) }; } using lazy_segtree = atcoder::lazy_segtree; static std::vector init(int n) { return std::vector(n, { mint(0), 1 }); } }; } // namespace kwm_t::aclwrapper #endif // KWM_T_ACLWRAPPER_LAZY_SEGTREE_VARIANTS_HPP int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin >> n; string s; cin >> s; rep(_, 2) { kwm_t::aclwrapper::RangeAddRangeMax::lazy_segtree seg(n); string t; if (_ == 0) { // L t = "L"; seg.apply(0, 1, 1); } else { // R t = "R"; seg.apply(0, n, 1); } rep2(i, 1, n) { int l = seg.get(i - 1) % 2; int r = seg.get(i) % 2; int b = l == r; int b2 = s[i - 1] == s[i]; if (b == b2) { t += 'L'; seg.apply(0, i + 1, 1); } else { t += 'R'; seg.apply(i, n, 1); } } bool chk = true; rep(i, n) { int x = seg.get(i) % 2; if (x && s[i] == 'o')chk = false; if (!x && s[i] == 'x')chk = false; } if (!chk)continue; cout << "Yes" << endl; cout << t << endl; return 0; } cout << "No" << endl; return 0; }