Pregunta de entrevista de Reward360

Write a program to find the value of x provided the input is a String equation. For example x = 4-2, another test case was 3x + 12 = 42.