@@ -0,0 +1,1676 @@
+import java.util.*;%0Aimport java.util.stream.Collectors;%0A%0Apublic class Solution %7B%0A%0A    private static final String DELETE = %22Delete%22;%0A    private static final String INSERT = %22Insert%22;%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner scanner = new Scanner(System.in);%0A%0A        int sizeOfList = scanner.nextInt();%0A        List%3CInteger%3E list = new ArrayList%3C%3E();%0A%0A        for (int i = 0; i %3C sizeOfList; i++) %7B%0A            list.add(scanner.nextInt());%0A        %7D%0A%0A        int numberOfQueries = scanner.nextInt();%0A        for (int i = 0; i %3C numberOfQueries; i++) %7B%0A            String operation = scanner.next().trim();%0A            scanner.nextLine();%0A            String input = scanner.nextLine().trim();%0A            executeQuery(list, operation, input);%0A        %7D%0A%0A        System.out.println(String.join(%22 %22, list.stream()%0A                                            .map(s -%3E String.valueOf(s))%0A                                            .collect(Collectors.toList())));%0A        scanner.close();%0A    %7D%0A%0A    public static void executeQuery(List%3CInteger%3E list, String operation, String input) %7B%0A        if (operation.equals(DELETE)) %7B%0A            list.remove(Integer.parseInt(input));%0A        %7D else if (operation.equals(INSERT)) %7B%0A            String%5B%5D splitString = input.split(%22 %22);%0A            int index = Integer.parseInt(splitString%5B0%5D);%0A            int value = Integer.parseInt(splitString%5B1%5D);%0A            if (index %3E list.size()) %7B%0A                list.add(value);%0A            %7D else %7B%0A                list.add(index, value);%0A            %7D%0A        %7D else %7B%0A            throw new Error(String.format(%22Unsupported operation %25s%22, operation));%0A        %7D%0A    %7D%0A%7D%0A

Solve java list