#include #include #include #include using namespace std; int n; int a[1100]; bool used[1100][1100]; string s, t; bool dfs(const int l, const int r) { if(l == r) return true; used[l][r] = true; for(auto &dl : {1, -1}) for(auto &dr : {-1, 1}) { int nl = l + dl, nr = r + dr; if(0 <= nl && nr <= n && a[nl] == a[nr] && !used[nl][nr]) { if(dfs(nl, nr)) { s += dl == 1 ? "R" : "L"; t += dr == 1 ? "R" : "L"; return true; } } } return false; } int main() { cin >> n; for(int i = 0; i <= n; i++) cin >> a[i]; if(dfs(0, n)) { cout << "Yes" << endl; reverse(s.begin(), s.end()); reverse(t.begin(), t.end()); cout << s.size() << endl; cout << s << endl; cout << t << endl; } else { cout << "No" << endl; } }