Language: Java

import java.util.Scanner;
import java.util.function.IntBinaryOperator;

public class Calc {

    static int lastIndexOf(String e, char ch) {
        int nest = 0;
        for(int i = e.length()-1; i > 0 ; i--) {
            char c = e.charAt(i);
            if(c == ‘(’) {
                nest++;
            }
            if(c == ‘)’) {
                nest--;
            }
            if(ch == c && nest == 0) {
                return i;
            }
        }
        return -1;
    }
    
    static int parse(String e) {
        if(e.startsWith(“(”) && e.endsWith(“)”)) {
            return parse(e.substring(1, e.length()-1));
        }
        int loc = lastIndexOf(e, ‘-’);
        if(loc != -1) {
            return parse(e.substring(0, loc)) - parse(e.substring(loc+1));
        }
        loc = lastIndexOf(e, ‘+’);
        if(loc != -1) {
            return parse(e.substring(0, loc)) + parse(e.substring(loc+1));
        }
        loc = lastIndexOf(e, ‘/’);
        if(loc != -1) {
            return parse(e.substring(0, loc)) / parse(e.substring(loc+1));
        }
        loc = lastIndexOf(e, ‘*’);
        if(loc != -1) {
            return parse(e.substring(0, loc)) * parse(e.substring(loc+1));
        }
        return Integer.parseInt(e);
    }
    
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            for(int i = 0; i < n; i++) {
                String e = sc.next().replace(“=”, “”);
                System.out.println(parse(e));
            }
        }
    }
}


Compiler output:
Main.java:10: error: illegal character: '\u2018'
            if(c == ?(?) {
                    ^
Main.java:10: error: illegal character: '\u2019'
            if(c == ?(?) {
                      ^
Main.java:13: error: illegal character: '\u2018'
            if(c == ?)?) {
                    ^
Main.java:13: error: illegal character: '\u2019'
            if(c == ?)?) {
                      ^
Main.java:24: error: illegal character: '\u201c'
        if(e.startsWith(?(?) && e.endsWith(?)?)) {
                        ^
Main.java:24: error: illegal character: '\u201d'
        if(e.startsWith(?(?) && e.endsWith(?)?)) {
                          ^
Main.java:24: error: illegal character: '\u201c'
        if(e.startsWith(?(?) && e.endsWith(?)?)) {
                                           ^
Main.java:24: error: illegal character: '\u201d'
        if(e.startsWith(?(?) && e.endsWith(?)?)) {
                                             ^
Main.java:27: error: illegal character: '\u2018'
        int loc = lastIndexOf(e, ?-?);
                                 ^
Main.java:27: error: illegal character: '\u2019'
        int loc = lastIndexOf(e, ?-?);
                                   ^
Main.java:31: error: illegal character: '\u2018'
        loc = lastIndexOf(e, ?+?);
                             ^
Main.java:31: error: illegal character: '\u2019'
        loc = lastIndexOf(e, ?+?);
                               ^
Main.java:35: error: illegal character: '\u2018'
        loc = lastIndexOf(e, ?/?);
                             ^
Main.java:35: error: illegal character: '\u2019'
        loc = lastIndexOf(e, ?/?);
                               ^
Main.java:39: error: illegal character: '\u2018'
        loc = lastIndexOf(e, ?*?);
                             ^
Main.java:39: error: illegal character: '\u2019'
        loc = lastIndexOf(e, ?*?);
                               ^
Main.java:50: error: illegal character: '\u201c'
                String e = sc.next().replace(?=?, ??);
                                             ^
Main.java:50: error: illegal character: '\u201d'
                String e = sc.next().replace(?=?, ??);
                                               ^
Main.java:50: error: illegal character: '\u201c'
                String e = sc.next().replace(?=?, ??);
                                                  ^
Main.java:50: error: illegal character: '\u201d'
                String e = sc.next().replace(?=?, ??);
                                                   ^
20 errors