For this Question: Given a String which contains Operators and Numbers.
Operators can be: ['+', '- ', '*', '/']
Numbers: Positive integers.
The task is to evaluate the given expression based on the <b>BODMAS</b> rule. 

<b>Note</b>: If the String starts or ends with any of the operators then that String would be considered invalid.Input contains a single line containing the string S.

Constraints:
1 <= numbers <= 9Return the result computed if the string is valid otherwise, it should return "String Invalid"Sample Input:
2 + 5 + 5 - 6 / 3 * 4

Sample Output:
4

Sample Input:
+ 2 + 6 + 3

Sample Output:
String Invalid, I have written this Solution Code: import java.io.*;
import java.util.*;

public class Main {

  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String exp = br.readLine();


    if(exp.charAt(0)=='+'|| exp.charAt(0)=='-'|| exp.charAt(0)=='*' || exp.charAt(0)=='/'||exp.charAt(exp.length()-1)=='+'|| exp.charAt(exp.length()-1)=='-'|| exp.charAt(exp.length()-1)=='*' || exp.charAt(exp.length()-1)=='/'){
						 System.out.println("String Invalid");
						 return;
						 }
    Stack<Integer> operands = new Stack<>();
    Stack<Character> operators = new Stack<>();

    for (int i = 0; i < exp.length(); i++) {
      char ch = exp.charAt(i);

       if (Character.isDigit(ch)) {
        operands.push(ch - '0');
      } else if (ch == '+' || ch == '-' || ch == '*' || ch == '/') {
        while (operators.size() > 0 &&  precedence(ch) <= precedence(operators.peek())) {
          int val2 = operands.pop();
          int val1 = operands.pop();
          char op = operators.pop();

          int opval = operation(val1, val2, op);
          operands.push(opval);
        }

        operators.push(ch);
      }
    }

    while (!operators.isEmpty()) {
      int val2 = operands.pop();
      int val1 = operands.pop();
      char op = operators.pop();

      int opval = operation(val1, val2, op);
      operands.push(opval);

    }

    int val = operands.pop();
    System.out.println(val);


  }

  public static int precedence(char op) {
    if (op == '+') {
      return 1;
    } else if (op == '-') {
      return 1;
    } else if (op == '*') {
      return 2;
    } else {
      return 2;
    }
  }

  public static int operation(int val1, int val2, char op) {
    if (op == '+') {
      return val1 + val2;
    } else if (op == '-') {
      return val1 - val2;
    } else if (op == '*') {
      return val1 * val2;
    } else {
      return val1 / val2;
    }
  }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?