#include <iostream>
#include <sstream>
#include <deque>
#include <vector>
using namespace std;
vector<int> getLineNum(string &str,char spilt){
stringstream ss(str);
string part;
vector<int> res;
while (getline(ss,part,spilt)) res.emplace_back(stoi(part));
return res;
}
int main(){
string str;
getline(cin,str);
vector<int> InV = getLineNum(str,',');
getline(cin,str);
vector<int> OutV = getLineNum(str,',');
string ans;
deque<int> tong;
int index = 0;
for (int in:InV) {
tong.push_back(in);
while (!tong.empty()){
if (tong.front() == OutV[index]){
ans += 'L';
tong.pop_front();
index++;
} else if (tong.back() == OutV[index]){
ans += 'R';
tong.pop_back();
index++;
} else{
break;
}
}
}
if (!tong.empty() || index!=OutV.size()) ans = "NO";
cout<<ans<<endl;
return 0;
}
篮球游戏(华为OD D卷)
最新推荐文章于 2024-07-31 19:22:02 发布