title: Calculator Mathematical Error
body: <p>I am use <a href="http://algs4.cs.princeton.edu/13stacks/Evaluate.java.html" rel="nofollow">Dijkstra's Two-stack Calculator</a> with Unity Engine.
  I am get a mathematical error.</p>
  
  <p>Input: <em>"3+2"</em>, Output: <em>5</em></p>
  
  <p><strong>BUT</strong></p>
  
  <p>Input: <em>"30+20"</em>, Output: <em>2</em></p>
  
  <p>What wrong with this code ?</p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>using System.Collections.Generic;
  public class Calculator
  {
      public float Evaluate(string Input)
      {
          string Expression = "(" + Input + ")";
          Stack&lt;string&gt; ops = new Stack&lt;string&gt;();
          Stack&lt;float&gt; vals = new Stack&lt;float&gt;();
          for (int i = 0; i &lt; Expression.Length; i++)
          {
              string s = Expression.Substring(i, 1);
              if (s.Equals("(")) { }
              else if (s.Equals("+")) ops.Push(s);
              else if (s.Equals("-")) ops.Push(s);
              else if (s.Equals("*")) ops.Push(s);
              else if (s.Equals("/")) ops.Push(s);
              else if (s.Equals(")"))
              {
                  int count = ops.Count;
                  while (count &gt; 0)
                  {
                      string op = ops.Pop();
                      float v = vals.Pop();
                      if (op.Equals("+")) v = vals.Pop() + v;
                      else if (op.Equals("-")) v = vals.Pop() - v;
                      else if (op.Equals("*")) v = vals.Pop() * v;
                      else if (op.Equals("/")) v = vals.Pop() / v;
                      vals.Push(v);
                      count--;
                  }
              }
              else vals.Push(float.Parse(s));
          }
          return vals.Pop();
      }
  }
  </code></pre>