#include <bits/stdc++.h>
using namespace std;
int main() {
int S, cnt = 1;
scanf("%d", &S);
deque<int> Q;
for(int i = 0; i < S; ++i) {
char op1, op2;
int K;
scanf("%c %c", &op1, &op2);
if (op1 == 'A') {
if (op2 == 'L') Q.push_front(cnt++);
else Q.push_back(cnt++);
}
else {
scanf("%d", &K);
if (op2 == 'L') {
while(K--) Q.pop_front();
}
else {
while(K--) Q.pop_back();
}
}
}
while(!Q.empty()) {
printf("%d\n", Q.front());
Q.pop_front();
}
return 0;
}
rt,注释处用scanf会收获满江紫,但用cin就行
求大佬解答