title: Solving a linear equation in one variable
body: <p>What would be the most efficient algorithm to solve a linear equation in one variable given as a string input to a function? For example, for input string: </p>
  
  <blockquote>
    <p>"x + 9 – 2 - 4 + x = – x + 5 – 1 + 3 – x" </p>
  </blockquote>
  
  <p>The output should be 1.</p>
  
  <p>I am considering using a stack and pushing each string token onto it as I encounter spaces in the string. If the input was in polish notation then it would have been easier to pop numbers off the stack to get to a result, but I am not sure what approach to take here.</p>
  
  <p>It is an interview question.</p>