import java.math.*;
public class Main {
public static void main(String[]args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
List<Integer>list=new ArrayList<>();
for(int i=0;i<n;i++)list.add(sc.nextInt());
sc.nextLine();//要吃掉换行符,否则会报错
for(int i=1;i<=m;i++) {
String[] s=sc.nextLine().split(" ");
if(s[0].equals("DEL")) {
list.remove(Integer.valueOf(Integer.parseInt(s[1]))); n--;//删除特定的值,不是下标对应的值
}
else {
n++;
int index=list.indexOf(Integer.parseInt(s[1])); list.add(index,Integer.parseInt(s[2]));
}
}
System.out.println(n);
for(Integer i:list)System.out.print(i+" ");
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:624 |
C语言程序设计教程(第三版)课后习题9.1 (C语言代码)浏览:532 |
明明的随机数 (C语言代码)浏览:613 |
1224题解浏览:475 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:504 |
A+B for Input-Output Practice (VII) (C++代码)浏览:1075 |
母牛生小牛 (C语言代码)浏览:989 |
WU-C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:1655 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:386 |
【亲和数】 (Java代码)浏览:635 |