<p>Given a string <code>formula</code> representing a chemical formula, return <em>the count of each atom</em>.</p>
<p>The atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.</p>
<p>One or more digits representing that element's count may follow if the count is greater than <code>1</code>. If the count is <code>1</code>, no digits will follow.</p>
<ul>
<li>For example, <code>"H2O"</code> and <code>"H2O2"</code> are possible, but <code>"H1O2"</code> is impossible.</li>
</ul>
<p>Two formulas are concatenated together to produce another formula.</p>
<ul>
<li>For example, <code>"H2O2He3Mg4"</code> is also a formula.</li>
</ul>
<p>A formula placed in parentheses, and a count (optionally added) is also a formula.</p>
<ul>
<li>For example, <code>"(H2O2)"</code> and <code>"(H2O2)3"</code> are formulas.</li>
</ul>
<p>Return the count of all elements as a string in the following form: the first name (in sorted order), followed by its count (if that count is more than <code>1</code>), followed by the second name (in sorted order), followed by its count (if that count is more than <code>1</code>), and so on.</p>
<p>The test cases are generated so that all the values in the output fit in a <strong>32-bit</strong> integer.</p>