Language: Java

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) {import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) {
        int n, idx, len;
        String s;
        LinkedList<Integer> list = new LinkedList<Integer>();
        StringBuilder out = new StringBuilder();
        Scanner sc = new Scanner(System.in);

        n = Integer.parseInt(sc.next());

        for (int i = 0; i < n; i++) {
            s = sc.next();

            switch (s) {
                case "insert":
                    list.addFirst(Integer.parseInt(sc.next()));
                    break;
                case "delete":
                    idx = list.indexOf(Integer.parseInt(sc.next()));
                    if (idx >= 0) list.remove(idx);
                    break;
                case "deleteFirst":
                    list.remove(0);
                    break;
                case "deleteLast":
                    list.remove(list.size() - 1);
                    break;
            }
        }

        len = list.size();
        idx = 0;

        for (Iterator<Integer> it = list.iterator(); it.hasNext();) {
            if (idx == len - 1) {
                out.append(it.next());
            } else {
                out.append(it.next()).append(" ");
            }
            idx++;
        }
        System.out.println(out);
    }
}
        int n, idx, len;
        String s;
        LinkedList<Integer> list = new LinkedList<Integer>();
        Scanner sc = new Scanner(System.in);

        n = Integer.parseInt(sc.next());

        for (int i = 0; i < n; i++) {
            s = sc.next();

            switch (s.split(" ")[0]) {
                case "insert":
                    list.addFirst(Integer.parseInt(sc.next()));
                    break;
                case "delete":
                    idx = list.indexOf(Integer.parseInt(sc.next()));
                    if (idx >= 0) list.remove(idx);
                    break;
                case "deleteFirst":
                    list.remove(0);
                    break;
                case "deleteLast":
                    list.remove(list.size() - 1);
                    break;
            }
        }

        len = list.size();
        idx = 0;

        for (Iterator<Integer> it = list.iterator(); it.hasNext();) {
            if (idx == len - 1) {
                System.out.println(it.next());
            } else {
                System.out.print(it.next() + " ");
            }
            idx++;
        }
    }
}

Compiler output:
Main.java:5: error: illegal start of expression
    public static void main(String args[]) {import java.io.*;
                                            ^
Main.java:5: error: <identifier> expected
    public static void main(String args[]) {import java.io.*;
                                                           ^
Main.java:5: error: illegal start of expression
    public static void main(String args[]) {import java.io.*;
                                                            ^
Main.java:6: error: illegal start of expression
import java.util.*;
^
Main.java:6: error: <identifier> expected
import java.util.*;
                 ^
Main.java:6: error: illegal start of expression
import java.util.*;
                  ^
Main.java:8: error: illegal start of expression
public class Main {
^
Main.java:57: error: <identifier> expected
        n = Integer.parseInt(sc.next());
         ^
Main.java:59: error: illegal start of type
        for (int i = 0; i < n; i++) {
        ^
Main.java:59: error: > or ',' expected
        for (int i = 0; i < n; i++) {
                             ^
Main.java:59: error: <identifier> expected
        for (int i = 0; i < n; i++) {
                                ^
Main.java:79: error: <identifier> expected
        len = list.size();
           ^
Main.java:80: error: <identifier> expected
        idx = 0;
           ^
Main.java:82: error: illegal start of type
        for (Iterator<Integer> it = list.iterator(); it.hasNext();) {
        ^
Main.java:82: error: <identifier> expected
        for (Iterator<Integer> it = list.iterator(); it.hasNext();) {
                                                               ^
Main.java:82: error: illegal start of type
        for (Iterator<Integer> it = list.iterator(); it.hasNext();) {
                                                                  ^
Main.java:91: error: class, interface, enum, or record expected
}
^
17 errors